Mutlipel fields with same name - getting the value in Netscape

M

mark.reichman

I have text fields in my form with the same name. I can reference the
value of these fields in IE 6.0 like with
document.form.field.value. However, netscape 4.7 seems to croak.
Why? What is the equivalent way to get the value in netscape 4.7.
 
G

Grant Wagner

I have text fields in my form with the same name. I can reference the
value of these fields in IE 6.0 like with
document.form.field.value. However, netscape 4.7 seems to croak.
Why? What is the equivalent way to get the value in netscape 4.7.


<body onload="alert(document.forms['myForm'].test[1].value);">
<form name="myForm">
<input type="text" name="test" value="1">
<input type="text" name="test" value="2">
</form>

Works fine in both Netscape 4.78 and Mozilla 1.5a.

As does document.myForm.test[1].value; and
document.forms['myForm'].elements['test'][1].value.

What doesn't work is: alert(myForm.test[1].value); since Netscape doesn't
not maintain a list of global references to forms and form elements in the
document like IE does.

--
| Grant Wagner <[email protected]>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/author/dhtml/reference/dhtml_reference_entry.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 6/7 and Mozilla
* http://www.mozilla.org/docs/web-developer/upgrade_2.html
 

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

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top