selectedIndexselectedIndex*
*Contents  *Index  *Topic Contents
*Previous Topic: selected
*Next Topic: self

selectedIndex

Description

Sets or retrieves an integer specifying the index of the selected option in a select object.

Syntax

object.selectedIndex[ = selectedIndex]

Remarks

Options in a select object are indexed in the order in which they are defined, starting with an index of zero. You can set the selectedIndex property at any time. The display of the select object updates immediately when you set the selectedIndex property. Both forms of the syntax specify the same value.

In general, this property is more useful for select objects that are created without the multiple attribute. If you evaluate selectedIndex when multiple options are selected, the selectedIndex property specifies the index of the first option only. Setting selectedIndex clears any other options that are selected in the select object.

The selected property of the select object's options array is more useful for select objects that are created with the MULTIPLE attribute. With the selected property, you can evaluate every option in the options array to determine multiple selections, and you can select individual options without clearing the selection of other options.

This property has read-write permissions, meaning you can change as well as retrieve its current value.

Applies To

SELECT


Up Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.