SELECT | NN 2 IE 3 DOM 1 | ||||
The SELECT object reflects the SELECT element. This element is a form control that contains OPTION elements. Note that the innerHTML and innerText properties are not available on the Macintosh version of Internet Explorer 4. | |||||
HTML Equivalent<SELECT> | |||||
Object Model Reference
|
accessKey | NN n/a IE 4 DOM n/a | ||
Read/Write | |||
A single character key that brings focus to the element. The browser
and operating system determine whether the user must press a modifier
key (e.g., | |||
Exampledocument.entryForm.mySelect.accessKey = "n" | |||
Value Single alphanumeric (and punctuation) keyboard character. | |||
|
dataFld | NN n/a IE 4 DOM n/a | ||
Read/Write | |||
Used with IE 4 data binding to associate a remote data source column name with the selectedIndex property of the SELECT object. A DATASRC attribute must also be set for the element. Setting both the dataFld and dataSrc properties to empty strings breaks the binding between element and data source. | |||
Exampledocument.forms[0].mySelect.dataFld = "choice" | |||
Value Case-sensitive identifier of the data source column. | |||
|
dataSrc | NN n/a IE 4 DOM n/a | ||
Read/Write | |||
Used with IE 4 data binding to specify the name of the remote ODBC data source (such as an Oracle or SQL Server database) to be associated with the element. Setting both the dataFld and dataSrc properties to empty strings breaks the binding between element and data source. | |||
Exampledocument.forms[0].mySelect.dataSrc = "#DBSRC3" | |||
Value Case-sensitive identifier of the data source. | |||
|
disabled | NN n/a IE 4 DOM 1 | ||
Read/Write | |||
Whether the element is available for user interaction. When set to true, the element cannot receive focus or be modified by the user. It is also not submitted with the form. | |||
Exampledocument.forms[0].elements[3].disabled = true | |||
Value Boolean value: true | false. | |||
|
form | NN 2 IE 3 DOM n/a | ||
Read-only | |||
Returns a reference to the FORM element that contains the current element (if any). This property is most often passed as a parameter for an event handler, using the this keyword to refer to the current form control. | |||
Example<SELECT NAME="units" onChange="recalc(this.form)"> | |||
Value Object reference. | |||
|
length | NN 2 IE 3 DOM 1 | ||
Read/Write | |||
The number of OPTION objects nested inside the SELECT object. You can adjust this value upward or downward, but there is some browser-specific behavior to watch out for. To genuinely add options to a SELECT object, you must follow the browser-specific way of creating new OPTION objects (see the options object for details). If you set this property to a number smaller than its original value, OPTION objects are deleted from the bottom of the list. A value of zero does not cause the element to disappear, but there are no selectable options in the element. | |||
Exampledocument.forms[0].mySelect.length = 3 | |||
Value Integer. | |||
|
multiple | NN n/a IE 4 DOM 1 | ||
Read/Write | |||
Whether the browser should render the SELECT
element as a list box and allow users to make multiple selections
from the list of options. By default the size
property is set to the number of nested OPTION
elements, but the value may be overridden with the
size property setting. Users can select contiguous
items by | |||
Exampleif (document.entryForm.list3.multiple) { ... } | |||
Value Boolean value: true | false. | |||
|
name | NN 2 IE 3 DOM 1 | ||
Read/Write | |||
The identifier associated with the form control. The value of this property is submitted as one-half of the name/value pair when the form is submitted to the server. Names are hidden from user view, since control labels are assigned via other means, depending on the control type. Form control names may also be used by script references to the objects. | |||
Exampledocument.orderForm.payment.name = "credcard" | |||
Value Case-sensitive identifier that follows the rules of identifier naming: it may contain no whitespace, cannot begin with a numeral, and should avoid punctuation except for the underscore character. | |||
|
recordNumber | NN n/a IE 4 DOM n/a | ||
Read-only | |||
Used with data binding, returns an integer representing the record within the data set that generated the element (i.e., an element whose content is filled via data binding). Values of this property can be used to extract a specific record from an Active Data Objects (ADO) record set (see recordset property). | |||
Example<SCRIPT FOR="tableTemplate" EVENT="onclick"> myDataCollection.recordset.absoluteposition = this.recordNumber ... </SCRIPT> | |||
Value Integer. | |||
|
selectedIndex | NN 2 IE 3 DOM 1 | ||
Read/Write | |||
The zero-based integer of the option selected by the user. If the SELECT element is set to allow multiple selections, the selectedIndex property returns the index of the first selected item (see the selected property). You can use this property to gain access to the value or text of the selected item, as shown in the example. | |||
Examplevar list = document.forms[0].selectList var listValue = list.options[list.selectedIndex].value | |||
Value Positive integer. | |||
|
tabIndex | NN n/a IE 4 DOM 1 | ||
Read/Write | |||
A number that indicates the sequence of this element within the tabbing order of all focusable elements in the document. Tabbing order follows a strict set of rules. Elements that have values other than zero assigned to their tabIndex properties are first in line when a user starts tabbing in a page. Focus starts with the element with the lowest tabIndex value and proceeds in order to the highest value, regardless of physical location on the page or in the document. If two elements have the same tabIndex values, the element that comes earlier in the document receives focus first. Next come all elements that either don't support the tabIndex property or have the value set to zero. These elements receive focus in the order in which they appear in the document. A value of -1 removes the element from tabbing order altogether. Note that the Macintosh user interface does not provide for giving focus to elements other than text and password INPUT fields. | |||
Exampledocument.forms[0].choices.tabIndex = 6 | |||
Value Integer. | |||
|
type | NN 3 IE 4 DOM 1 | ||
Read-only | |||
Returns the type of form control element. A SELECT object has two possible values, depending on whether the element is set to be a multiple-choice list. The value is returned in all lowercase letters. It may be necessary to cycle through all form elements in search of specific types to do some processing on (e.g., emptying all form controls of type "text" while leaving other controls untouched). | |||
Exampleif (document.forms[0].elements[3].type == "select-multiple") { ... } | |||
Value Any of the following constants (as a string): button | checkbox | file | hidden | image | password | radio | reset | select-multiple | select-one | submit | text | textarea. | |||
|
value | NN n/a IE 4 DOM 1 | ||
Read/Write | |||
Current value associated with the form control that is submitted with the name/value pair for the element. All values are strings, but they may represent other kinds of data, including Boolean and numeric values. Internet Explorer automatically stuffs the value property of the selected OPTION object into the SELECT object's value property. | |||
Exampleif (document.forms[0].medium.value == "CD-ROM") { ... } | |||
Value String. | |||
|
blur( ) | NN n/a IE 4 DOM n/a |
Removes focus from the current element and fires an onBlur event (in IE). No other element necessarily receives focus as a result. | |
Returned Value None. | |
Parameters None. |
focus( ) | NN n/a IE 4 DOM n/a |
Gives focus to the current element and fires the onFocus event (in IE). If another element had focus at the time, it receives an onBlur event. | |
Returned Value None. | |
Parameters None. |
options[ ] | NN 2 IE 3 DOM 1 |
An array of all OPTION objects contained by the current element. Items in this array are indexed (zero based) in source code order. For details on using this collection for adding and removing OPTION elements from a SELECT element in Internet Explorer, see the options object. |