当前位置: 代码迷 >> JavaScript >> 怎么获取选中的下拉列表的值(id)
  详细解决方案

怎么获取选中的下拉列表的值(id)

热度:71   发布时间:2012-03-21 13:33:15.0
如何获取选中的下拉列表的值(id)
我是动态获得option个数和内容的,获得后我想获得选中的optionID   请问怎么获得啊!谢谢

------解决方案--------------------
var obj=document.getElementById( "select ID ")
alert(obj.options[obj.selectedIndex].text)
alert(obj.options[obj.selectedIndex].value)
------解决方案--------------------
楼上正解
  相关解决方案