<select size= "1 " name= "runner ">
<option> <a id= "a "> 中文 </a> </option>
<option> <a id= "b "> 英语 </a> </option>
</select>
用javascript
var get_select=form1.runner.selectedIndex
显示文本为:form1.runner.options[get_select].text
var get_value = form1.runner.getElementById().value;
<option> <a id= "a "> 中文 </a> </option>
<option> <a id= "b "> 英语 </a> </option>
</select>
用javascript
var get_select=form1.runner.selectedIndex
显示文本为:form1.runner.options[get_select].text
var get_value = form1.runner.getElementById().value;
本文详细介绍了如何使用JavaScript操作HTML表单中的选择元素,包括获取选项文本和值的方法。通过实例演示了如何通过索引获取选项文本与值,适用于前端开发者了解表单交互。
4966

被折叠的 条评论
为什么被折叠?



