home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


JavaScript: The Definitive Guide

Previous Chapter 21
JavaScript Reference
Next
 

Select.options[] Property

Name

Select.options[] Property---the choices in a Select object

Availability

Navigator 2.0, Internet Explorer 3.0; enhanced in Navigator 3.0

Synopsis

select.options[i]
select.options.length

Description

The options[] property contains an array of Option objects, each of which describe one of the selection options presented within the Select object select. The options.length property specifies the number of elements in the array, as does the select.length property. See the Option object for further details.

In Navigator 3.0, you can modify the options displayed in a Select object in any of the following ways:

  • If you set options.length to 0, all options in the Select object will be cleared.

  • If you set options.length to a value less than the current value, then the number of options in the Select object will be decreased, and those and the end of the array will disappear.

  • If you set an element in the options[] array to null, then that option will be removed from the Select object, and the elements above it in the array will be moved down, changing their indices, to occupy the new space in the array.

  • If you create a new Option object with the Option() constructor (see the Option reference entry), you can add that option to the end of list of options in the Select object by assigning the newly created option to a position at the end of the options[] array. To do this, set options[options.length].


Previous Home Next
Select.onfocus() Book Index Select.selectedIndex

HTML: The Definitive Guide CGI Programming JavaScript: The Definitive Guide Programming Perl WebMaster in a Nutshell