can't read value from <input type=file> in netscape

M

myahact

Hello,

I have <input type=file id=myfile> in a form.
In IE I can read the value thusly:

document.getElementById("myfile").value

But thusly returns "" in Mozilla/Netscape.

I also tried through the DOM but

node.value was ""
node.text was ""

Can I not read this value in Moz/NS?
 
R

Randy Webb

(e-mail address removed) said the following on 10/29/2005 3:54 PM:
Hello,

I have <input type=file id=myfile> in a form.
In IE I can read the value thusly:

document.getElementById("myfile").value

But thusly returns "" in Mozilla/Netscape.

I also tried through the DOM but

node.value was ""
node.text was ""

Can I not read this value in Moz/NS?

Yes, you use a name attribute and the forms collection:

<script type="text/javascript">
function getValue(formRef){
alert(formRef.fileInput.value)
}
</script>

<form name="myForm">
<input type="file" onchange="alert(this.value)" name="fileInput"><br />
<input type="button" value="Get The Value"
onclick="getValue(this.form)">
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,888
Messages
2,569,964
Members
46,294
Latest member
HollieYork

Latest Threads

Top