[Javascript] Radio Button Value Property Does Not Exist in Netscape 6.1?

gregory.john.toland at census.gov gregory.john.toland at census.gov
Mon Oct 29 09:02:37 CST 2001


Sorry.  That was just a typo.  The form is really called frmProfiles.  When
I sent out the email I changed the name of the form to myForm.

OK.  I got it to work.  But why???????  Why would appending the characters
[ and ] cause the statement to work.  I'm confused!

Gregory J Toland


 From Hassan Schroeder ...

gregory.john.toland at census.gov wrote:
>
> Huh?  Netscape doesn't like
>
> document.forms["frmProfiles"].txtStep1[]       OR

- understandable, since that's not the name you gave your form :-)

> document.frmProfiles.txtStep1[][01].value
>
> Is that what you meant?

> > <form enctype="text/plain" id="myForm" method="get"
> >       name="myForm" onSubmit="return true;">
> >    <input checked id="txtStep1" name="txtStep1"
> >           tabindex="1"
> >           title="Tabular Profile" type="radio"
> >           value="Tabular">Tabular</input>
> >    <input id="txtStep1" name="txtStep1"
> >           title="Narrative Profile" type="radio"
> >           value="Narrative">Narrative</input>
> > </form>

No, what I meant is what I originally said:

> change id="txtStep1" to id="txtStep1[]" and it works in NS4,6,IE5 ...

/* test - put this in a page:

<body>
<form
     enctype="text/plain" id="myForm" method="get" name="myForm" onSubmit
="return true;">
   <input checked id="txtStep1[]" name="txtStep1"
          tabindex="1"
          title="Tabular Profile" type="radio"
          value="Tabular">Tabular</input>
   <input id="txtStep1[]" name="txtStep1"
          title="Narrative Profile" type="radio"
          value="Narrative">Narrative</input>
</form>

<script type="text/javascript">
   alert(document.myForm.txtStep1[1].value);
</script>

</body>

 */

HTH!





More information about the Javascript mailing list