EN
이 콘텐츠는 한국어로 제공되지 않아 영어 버전으로 표시됩니다.

options property

Retrieves a collection of the option objects in a select object.

Syntax

JavaScript

p = object.options

 

Property values

Type: Object

Array of option objects.

Standards information

There are no standards that apply here.

Remarks

To delete an option object from a select object, assign the option object a null value. This compresses the array.

If duplicate identifiers are found, a collection of those items is returned. Collections of duplicates must be referenced subsequently by ordinal position.

Examples

This example shows how to display the text and values of all option objects in the first select object 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);
}

 

 

표시:
© 2014 Microsoft