Webmaster in a Nutshell, 3rd Edition By Robert Eckstein, Stephen Spainhour
Table of Contents
Chapter 11. JavaScript
Option
Client-Side JavaScript 1.0
A selectable option
Inherits From: Element
select .options[ i ]
Constructor
In JavaScript 1.1 and later, Option objects can be created dynamically with the Option( ) constructor:
new Option( text , value , defaultSelected , selected )
Properties
defaultSelected
A read/write boolean that specifies whether the option is initially selected when the Select object that contains it is created or reset.
index
A read-only integer that specifies the index of the option within the options[ ] array of the Select object that contains it.
selected
A read/write boolean value that specifies whether an option is currently selected. You can use this property to test whether a given option is selected. You can also set it to select or deselect an option. Note that when you select or deselect an option in this way, the Select.onchange( ) event handler is not invoked.
text
A read/write string that specifies the text that appears to the user for the option.
value
A read/write string that specifies the text that is passed to the web server if the option is selected when the form is submitted.