HBCMS更多的中文手册参考:

selectedIndex参数属性

DHTML文档教程

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

dhtml语法

htmln/a
scriptingselect.selectedindex [ = iindex ]

dhtml可能的值

iIndexInteger that specifies or receives the index.

The property is read/write. The property has no default value.

Expressions can be used in place of the preceding value(s), as of Microsoft® Internet Explorer 5. For more information, see about dynamic properties.

remarks

options in a select object are indexed in the order in which they are defined, starting with an index of 0. when you set the selectedindex property, the display of the select object updates immediately.

the selectedindex property returns -1 if a select object does not contain any selected items. setting the selectedindex property clears any existing selected items.

the selectedindex property is most useful when used with select objects that support selecting only one item at a time—that is, those in which the multiple attribute is not specified. if the multiple attribute is specified for a select object, the selectedindex property returns only the index of the first selected item, if any.

the selected property is most useful when used with select objects that support selecting more than one item at a time—that is, those in which the multiple attribute is specified. you can use the selected property to determine whether an individual item in a select object is selected. in addition, selected items are not cleared when the selected property is set. this allows multiple items in the list to be selected at the same time.

DHTML代码范例

This example uses the selectedIndex property to retrieve individual values from a select object. When a site is selected from the list, the browser displays the associated page.

<SELECT onchange="window.location.href=this.options
[this.selectedIndex].value">
<OPTION VALUE="/hbcms/php/r.php?url=http%3A%2F%2Fwww.microsoft.com/ie">
Internet Explorer</OPTION>
<OPTION VALUE="/hbcms/php/r.php?url=http%3A%2F%2Fwww.microsoft.com">
Microsoft Home</OPTION>
<OPTION VALUE="/hbcms/php/r.php?url=http%3A%2F%2Fmsdn.microsoft.com">
Developer Network</OPTION>
</SELECT>

是否符合公共标准

This property is defined in World Wide Web Consortium (W3C) Document Object Model (DOM) Level 1 Non-Microsoft link.

Applies To

SELECT