[thelist] Radio Button Value Property Does Not Exist in Netscape 6.1?
.jeff
jeff at members.evolt.org
Mon Oct 29 13:39:54 CST 2001
greg,
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> From: gregory.john.toland at census.gov
>
> In Netscape 4.X and IE 5.X the code:
>
> alert( document.MyForm.txtStep1[01].value );
>
> returns "Narrative"
>
> In Netscape 6.1 the same code gives an error message
> in the Javascript console:
>
> "Error: document.myForm.txtStep1[1] has no properties."
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
try accessing it like this:
alert( document.MyForm.txtStep1[1].value );
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> Did something change?
>
> In Netscape 6.1 if I use:
>
> alert( document.MyForm.txtStep1.value );
>
> I get the correct answer, "Tabular".
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
is that the value of the radio button that's checked?
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> I cannot use this code in IE 5.X and NN 4.X, however.
> It gives a result of "undefined".
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
that's correct. that's because the element "txtStep1" is an array of radio
buttons.
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> Must we have different code for the two sets of browsers
> for accessing such basic properties of form elements?
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
no, we don't. my gut says there's something else causing this problem in
nn6.1.
try getting it to tell you how many elements on the page share the name
"txtStep1".
alert(document.myForm.txtStep1.length);
good luck,
.jeff
http://evolt.org/
jeff at members.evolt.org
http://members.evolt.org/jeff/
More information about the thelist
mailing list