See also: getRadioButtonChecked

Function used to set the radio button that is checked by indicating the value of the RADIO object.

Syntax

JSV_setRadioButtonCheckedByValue(radioButtonObj, searchValue [, compareCase])

Prototype

n/a

Returns

n/a

Parameters

The setRadioButtonCheckedByValue function uses the following arguments.

Argument Description
radioButtonObj The RADIO object.
searchValue Specifies the value that is to be searched for in the RADIO object.
compareCase Optional. Default is false--case insensitive comparison.

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="setRadioButtonCheckedByValue.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="Set Moe as Stooge"
       CLASS="jsvButtons"
       onClick="performTest(this.form);">
</FORM>

<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
function performTest(formObj) {
    JSV_setRadioButtonCheckedByValue(formObj.RadioTest, "Moe");
}
</SCRIPT>

produce

Larry
Curly
Moe
Curly Joe
Shemp