select下拉列表的onChange事件javascript
select下拉列表的onChange事件...
select onChange事件,实现效果为,选择下拉框中的一个把他显示出来.
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>select onChange事件</title> </head> <body> <select id="EffectiveDateSel" onChange="DispayPrice();"> <option>切换 <b class="caret"></b></option> <option value="121.473701,31.230416,200000">上海市</option> <option value="116.407526,39.90403,100000">北京市</option> <option value="103.826308,36.059421,620100000000">兰州市</option> <option value="113.264434,23.129162,510000">广州市</option> </select> <span id="cityse"></span> <script> function DispayPrice() { var nSel = document.getElementById("EffectiveDateSel"); var index = nSel.selectedIndex; // 选中索引 var text = nSel.options[index].text; // 选中文本 var value= nSel.options[index].value; // 选中值 document.getElementById("cityse").innerHTML=text+"----"+value; } </script> </body> </html>
上一篇:js获取select选择的值
最新评论
热门推荐
我要评论