如何取得select的字符串?

zsl_007 2003-06-12 09:12:06
我想取得select对象当前选择的项的字符串,要怎么办?用value和txt好像都不行,只能取得当前选择的项的索引值,selectindex
...全文
54 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
helimin19 2003-06-13
  • 打赏
  • 举报
回复
<select onchange="javascitp:alert(this.options[this.selectedIdenx].value)">

for(i=0;i<document.form1.select1.length;i++)
if(document.form1.select1.options[i].selected==true)
alert(document.form1.select1.options[i].value;
aztec 2003-06-13
  • 打赏
  • 举报
回复
document.selection.createRange().text;
seabell 2003-06-12
  • 打赏
  • 举报
回复
<select onchange=alert(this.options[this.selectedIndex].text)>
<option>1
<option>2
<option>3
</select>
zsl_007 2003-06-12
  • 打赏
  • 举报
回复
哪位大虾帮帮忙啊,在线等待!
zhanghk 2003-06-12
  • 打赏
  • 举报
回复
up

87,987

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧