See also:  setOptionAttributes, setOptionText, setOptionValue, setSelectedOption, setSelectedOptionByText, setSelectedOptionByValue, getSelectIndexByValue, getSelectOptionText

Function used to determine the selected option value.

Syntax

JSV_getSelectOptionValue(selectObj)

Prototype

n/a

Returns

The value of the selected option. If no option is selected, returns null.

Parameters

The getSelectOptionValue function uses the following arguments.

Argument Description
selectObj The SELECT object.

Remarks

n/a

Dependencies

n/a

Example

The following lines of code

<FORM ACTION="getSelectOptionValue.html" NAME="SelectTest" ID="SelectTest" onSubmit="return false;">
<SELECT NAME="ChangeSelect" ID="ChangeSelect" SIZE="1">
<OPTION VALUE="1" SELECTED>One</OPTION>
<OPTION VALUE="2">Two</OPTION>
<OPTION VALUE="3">Three</OPTION>
<OPTION VALUE="4">Four</OPTION>
<OPTION VALUE="5">Five</OPTION>
<OPTION VALUE="6">Six</OPTION>
</SELECT>
<INPUT TYPE="button"
       NAME="btnTest"
       VALUE="Get Selected Value"
       CLASS="jsvButtons"
       onClick="performTest(this.form);">
</FORM>

<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
function performTest(formObj) {
    alert( "Selected Value: " + JSV_getSelectOptionValue(formObj.ChangeSelect) );
}
</SCRIPT>

produce