|
Function used to determine the selected index.
JSV_getSelectIndexByText(selectObj, searchText [, compareCase])
n/a
The index of the OPTION with the designated text,
or SELECTNOTEXISTS
if the designated text could not be found.
The getSelectIndexByText function uses the following arguments.
Argument | Description |
selectObj | The SELECT object. |
searchText | Specifies an OPTION value that is to be searched for in designated SELECT object. |
compareCase | Optional. Default is false--case insensitive comparison. |
n/a
n/a
The following lines of code
<FORM ACTION="getSelectIndexByText.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 Index of 'Three'"
CLASS="jsvButtons"
onClick="performTest(this.form);">
</FORM>
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
function performTest(formObj) {
alert( "Selected Index: " + JSV_getSelectIndexByText(formObj.ChangeSelect, "Three", true) );
}
</SCRIPT>
produce
Copyright © 2000 Roaring Fork Software. All rights reserved.