[thelist] DOM lvl 0 forms: accessing radio buttons

Tom Dell'Aringa pixelmech at yahoo.com
Thu Feb 6 18:31:02 CST 2003

Hey all,

I of course am using the DOM lvl 0 to access forms. Now, I have a
situation where there may be variations on a radio group. Usually its
in this order:

<input type="radio" value="1" name="CROption"
onclick="updateCreditReportId();" /> Option 1

<input type="radio" value="2" name="CROption"
onclick="updateCreditReportId();" /> Option 2

BUT - sometimes its REVERSED (the 2nd option is first, with some
other unrelated changes).

Right now, I would check for the first option like this:

document.forms["formName"].CROption[0].checked == true

using the array of radio buttons in that group.

Is there another way to get into the radio array? Even this reference
is in a sense incomplete, since I didn't use elements[], but wasn't
sure how to do it with the radio array included.

I need to essentially be able to reference that one particular radio
button by name - so no matter what order it ends up in we can check



var me = tom.pixelmech.webDeveloper();

[Making A Commercial Case for Adopting Web Standards]

Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.

More information about the thelist mailing list