select onChange事件

来源:互联网 发布:政府机构邮箱搜索软件 编辑:程序博客网 时间:2024/05/16 14:27

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>




原创粉丝点击