See also: getRadioButtonChecked, setRadioButtonCheckedByValue

Function used to determine the value of the radio button that is checked.

Syntax

JSV_getRadioButtonCheckedValue(radioButtonObj)

Prototype

n/a

Returns

The index of the radio button that is checked, or RADIONOTEXISTS if no radio buttons are checked.

Parameters

The getRadioButtonCheckedValue function uses the following arguments.

Argument Description
radioButtonObj The RADIO object.

Remarks

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.

Dependencies

n/a

Example

The following lines of code

<FORM ACTION="getRadioButtonCheckedValue.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_getRadioButtonCheckedValue(formObj.RadioTest);
    alert( "Selected Stooge: " + rbChecked );
}
</SCRIPT>

produce

Larry
Curly
Moe
Curly Joe
Shemp