...

View Full Version : Check state of radio button?



javajeff
12-31-2007, 08:36 PM
How do I check the state of a radio button? I am new to javascript.

My button that expands a hidden table:
<INPUT type="radio" name="ship" onclick="toggletable('expand1','Y'); return true;" CHECKED><a>Yes</a>
&nbsp;
<INPUT type="radio" name="ship" onclick="toggletable('expand1','N'); return true;"><A>No</A>

Where I need help:

<input type="image" src="./images/checkout.gif" name="submit" value="Submit" onClick="if (ship[1] ){createTel(); return checkForm();}">

Everything works except where I have ship[1]. The second radio needs to execute the two functions with the onClick. Thanks!

felgall
12-31-2007, 10:01 PM
if (ship[1].checked)

javajeff
01-01-2008, 01:23 PM
Thank you. I knew it was something simple, but did not know the exact format.

Regards,

Jeff



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum