HBCMS更多的中文手册参考:

text参数属性

DHTML文档教程

Sets or retrieves the text string specified by the option tag.

dhtml语法

htmln/a
scriptingoption.text [ = stxt ]

dhtml可能的值

sTxtString that specifies or receives the text.

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

assigning a value to the text property changes the text property internally, but does not cause the listed value to change. submitting the form submits the internally stored value, not the one displayed.

DHTML代码范例

This example uses the text property to change the text string of each option each time the user selects an option.

<SCRIPT>
function fnShow(){
for(var i=0;i<oSel.options.length;i++){
oSel.options[i].text+=" (slugs)";
}
}
function fnFlash(){
var sQuery="";
for(var i=0;i<oSel.options.length;i++){
sQuery+=i + " - Value=" + oSel.options[i].value +
" - Text=" + oSel.options[i].text + "\n";
}
alert(sQuery);
}
</SCRIPT>
<SELECT ID=oSel onchange="fnFlash()">
<OPTION VALUE="US">Seattle
<OPTION VALUE="FRANCE">Paris
<OPTION VALUE="MEXICO">Cabo San Lucas
</SELECT>
<INPUT TYPE=button VALUE="Show Attractions" onclick="fnShow()">
This feature requires Microsoft® Internet Explorer 5 or later. Click the following icon to install the latest version. Then reload this page to view the sample.

是否符合公共标准

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

Applies To

OPTION