|
Function used to select a specific option associated with a given SELECT object by specifying the integer index.
JSV_setSelectedOption(selectObj, optionIndex)
n/a
n/a
The setSelectedOption function uses the following arguments.
Argument | Description |
selectObj | The SELECT object. |
optionIndex | An integer specifying the index of the option to select in a SELECT object. |
n/a
n/a
The following lines of code
<FORM ACTION="setSelectedOption.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="Select Option 4"
CLASS="jsvButtons"
onClick="performTest(this.form);">
</FORM>
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
function performTest(formObj) {
JSV_setSelectedOption(formObj.ChangeSelect, 3);
}
</SCRIPT>
produce
Copyright © 2000 Roaring Fork Software. All rights reserved.