如何取select的标签。 也就是如何用在JavaScript中引用select的文本? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 var oItems=document.all.select.options;var oItem=oItems[oItems.selectedIndex];alert(oItem.innerText); <html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>新建网页 3</title></head><body><form>请选择一个水果:<select name="select" onchange="abc()"><option value="1">苹果</option><option value="2">梨子</option><option value="3" selected>香蕉</option><option value="4">西瓜</option><option value="5">葡萄</option></select><script language="javascript">function abc(){ var oItems=document.all.select.options; var oItem=oItems[oItems.selectedIndex]; alert(oItem.innerText);}</script></form></body></html> < select name="select" onChange="javascript:alert(this.options[selectedIndex].text);">< option value="1">苹果</option>< option value="2">梨子</option>< option value="3" selected>香蕉</option>< option value="4">西瓜</option>< option value="5">葡萄</option>< /select>谢谢啊,我也找到答案了~ 求高手指点javascript的AMD规范 jquery如何选中radio replace(星号,“XXX”)的问题 JSON两问:如何生成json数据,如何防御错误 谁有人员选取组件的代码?谢谢 如何在<a style="..">链接样式</a>的内联样式style中表示链接的各种样式,如link,hover,active.. 求救:如何获得客户端的屏幕分辨率 按钮转换问题>>> 关于直接弹出文件保存对话框的问题。。。 请教一个画板的问题 isNaN(num.value)的问题 JS高手来帮忙改一下
var oItem=oItems[oItems.selectedIndex];
alert(oItem.innerText);
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新建网页 3</title>
</head>
<body>
<form>
请选择一个水果:
<select name="select" onchange="abc()">
<option value="1">苹果</option>
<option value="2">梨子</option>
<option value="3" selected>香蕉</option>
<option value="4">西瓜</option>
<option value="5">葡萄</option>
</select>
<script language="javascript">
function abc()
{
var oItems=document.all.select.options;
var oItem=oItems[oItems.selectedIndex];
alert(oItem.innerText);
}
</script>
</form>
</body>
</html>
< option value="1">苹果</option>
< option value="2">梨子</option>
< option value="3" selected>香蕉</option>
< option value="4">西瓜</option>
< option value="5">葡萄</option>
< /select>谢谢啊,我也找到答案了~