View Single Post
  #4 (permalink)  
Old Nov 30th, 2007, 02:36
Rakuli's Avatar
Rakuli Rakuli is offline
SuperMember

SuperMember
Join Date: Sep 2007
Location: Australia
Age: 24
Posts: 956
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Repeat data entered in a text box... and maybe change it?

Okay, I get what you're saying but you are talking about <input type="file">'s right?

You click on browse or find and it opens a window to select a file then once selected the path to the file goes into the text box. Javascript can't change this value because if you could do that with javascript, then the file at that path can then be sent to the server so a malicious coder could ask for c:\passwords.txt and that file would be sent to the website without the user knowing.

You can change the values of text boxes easily enough but not file inputs.

Code: Select all
<script type="text/javascript">

function changeTexts(value) {
var inputBoxes = document.getElementByTagName(''input');

for (i = 0; i< inputBoxes.length; i++){
if (inputBoxes[i].type == 'text') {
     inputBoxes[i].value = value;
}
}
}
</script>

<input type="text" value="" name="hi" onchange="changeTexts(this.value)"/>
<input type="text" value="" name= "hi1" />
<input type="text" value="" name="hi3" />
Reply With Quote