August 1999
Intermediate to advanced
1488 pages
72h 53m
English
getOptionValue(key, num)
The getOptionValue function is a top-level function that is not associated with any object. This function returns the same value as the client-side Option.text property. The key passed in as an argument represents the NAME attribute of the <SELECT> tag, while the num parameter is the indexed position of the selected option. Specifying num to 0 can reference the first selected option, which may not be the first option.
Listing 8.91 displays a multi-select option box that allows a user to select different sports. When the Submit button is clicked, the form is sent back to itself and the script then uses a for loop and the getOptionValue function to write the submitted ...
Read now
Unlock full access