[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ?? document.form.radio.value ??



Radio buttons are arrays, so the correct syntax (for the first button) is:

   alert(document.itemsform.itemx[0].value); 



At 04:35 AM 2/21/96 EST, you wrote:
>In the JavaScript code below, the second alert displays 
>
>      <undefined>.
>
>If I do exactly the same thing but using a checkbox, it works fine.  
>
>Am I doing something wrong or is this a bug?
>
>Netscape 2.0 final, PowerMac 7100/80.
>
>Thanks.
>
>Bill
>==========================================
><script language=javascript>
><!--  hide this stuff
>
>function radioclick(foo) {
>  alert(foo);
>  alert(document.itemsform.itemx.value);   // This reports <undefined>
>}
>
>//   Stop hiding    -->
>
></script>
>
><form name="itemsform" action="foo">
>
><input type="radio" name="itemx" value="pasta" onClick="radioclick('pasta')">
>Pasta<br>
><input type="radio" name="itemx" value="tomsauce"
>onClick="radioclick('tomsauce')"> Tomato Sauce
>
></form>

--------------------------------------------------------------------
This message came from the mailing list javascript. For help using the
mailing list software, please send a message to 'majordomo@obscure.org'
with the message body 'help'. To unsubscribe, send a message to
'majordomo@obscure.org' with the message body 'unsubscribe javascript'.