See also: setRadioButtonCheckedByValue |
Function used to determine the index of the radio button that is checked.
JSV_getRadioButtonChecked(radioButtonObj)
n/a
The index of the radio button that is checked,
or RADIONOTEXISTS
if no radio buttons are checked.
The getRadioButtonChecked function uses the following arguments.
Argument | Description |
radioButtonObj | The RADIO object. |
If a radio button is selected, the value of its checked property is true; otherwise, it is false.
At any given time, only one button in a set of radio buttons can be checked. When you set the checked property for one radio button in a group to true, that property for all other buttons in the group becomes false.
n/a
The following lines of code
<FORM ACTION="getRadioButtonChecked.html" NAME="SelectTest" ID="SelectTest" onSubmit="return false;">
<INPUT TYPE="radio" NAME="RadioTest" VALUE="Larry" CHECKED>Larry<BR>
<INPUT TYPE="radio" NAME="RadioTest" VALUE="Curly">Curly<BR>
<INPUT TYPE="radio" NAME="RadioTest" VALUE="Moe">Moe<BR>
<INPUT TYPE="radio" NAME="RadioTest" VALUE="Curly Joe">Curly Joe<BR>
<INPUT TYPE="radio" NAME="RadioTest" VALUE="Shemp">Shemp<BR><BR>
<INPUT TYPE="button"
NAME="btnTest"
VALUE="Get Stooge"
CLASS="jsvButtons"
onClick="performTest(this.form);">
</FORM>
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
function performTest(formObj) {
var rbChecked = JSV_getRadioButtonChecked(formObj.RadioTest);
alert( "Selected Stooge: " + rbChecked + "\n" + formObj.RadioTest[rbChecked].value );
}
</SCRIPT>
produce
Copyright © 2000 Roaring Fork Software. All rights reserved.