Forum Moderators: open

Message Too Old, No Replies

JavaScript help

         

andrewsmd

1:44 pm on Jul 17, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I am kind of new to javascript. I have a form that looks something like this.

<form ENCTYPE="multipart/form-data" name = "fileSplit" method = "post">
<input type = "text" name = "text" size = "32">
<INPUT NAME="userfile" TYPE="file">
</form>

I want to copy and paste the text that comes from the browse button into the first textbox automatically with JS. Does anyone know how?

gcarn

3:12 pm on Jul 17, 2008 (gmt 0)

10+ Year Member



<script>
function runMe(imafilevalue){
var textBox=document.getElementById('text');
textBox.value=imafilevalue;
}
</script>

<form ENCTYPE="multipart/form-data" name = "fileSplit" method = "post">
<input type = "text" name = "text" id='text' size = "32">
<INPUT NAME="userfile" TYPE="file" onblur="runMe(this.value)">
</form>

now, this will work, although its functionality is interesting,
In IE, it gives you the full path, firefox just gives you the filename