IHTMLSelectElement::get_selectedIndexIHTMLSelectElement::get_selectedIndex*
*Contents  *Index  *Topic Contents
*Previous Topic: IHTMLSelectElement::put_selectedIndex
*Next Topic: IHTMLSelectElement::get_type

IHTMLSelectElement::get_selectedIndex


HRESULT get_selectedIndex(
    long *p 
);

Retreives the index of the selected item in the list box or drop-down list associated with the select object.

p
Address of a variable that receives the index of the selected item.

Options in a select object are indexed in the order in which they are defined, starting with an index of 0. 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, the selectedIndex 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.

See also put_selectedIndex

Up Top of Page


IHTMLSelectElement::put_selectedIndex


HRESULT put_selectedIndex(
    long v 
);

Selects an item in the list box or drop-down list associated with the select object.

v
Value specifying the zero-based index of the item to select.

Options in a select object are indexed in the order in which they are defined, starting with an index of 0. 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, the selectedIndex 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.

See also get_selectedIndex


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