Contents Index Topic Contents | ||
Previous Topic: links Next Topic: plugins |
options
Description
Retrieves a collection of the OPTION elements in a SELECT object.
Syntax
object.options(index)
Parameter Description object A SELECT element. (index) Optional. An integer or a string specifying the index value of the element to retrieve. Integer indexes are zero-based, meaning the first element in the collection has index 0. A string index is valid only if the string is an identifier of at least one element in the document. Remarks
To delete an option from a SELECT object, you assign the option a null value. This compresses the array.
If duplicate identifiers are found, a collection of those items is returned. Collections of duplicates must subsequently be referenced by ordinal position.
Example
The following example displays the text and values of all OPTION elements in the first SELECT element in the document.
var coll = document.all.tags("SELECT"); if (coll.length>0) { for (i=0; i< coll(0).options.length; i++) alert("Element " + i + " is " + coll(0).options(i).text + " and has the value " + coll(0).options(i).value); }Property
Methods
Applies To
Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.