最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

javascript獲取select的當(dāng)前值示例代碼(兼容IE/Firefox/Opera/Chrome)

 更新時(shí)間:2013年12月17日 09:20:41   作者:  
本篇文章主要介紹了javascript獲取select的當(dāng)前值示例代碼(兼容IE/Firefox/Opera/Chrome) 需要的朋友可以過來參考下,希望對大家有所幫助

JavaScript獲取Select當(dāng)前值寫法:
var value = document.getElementById("select").options[document.getElementById("select").options.selectedIndex].value;
var text = document.getElementById("select").options[document.getElementById("select").options.selectedIndex].text;

例子:

復(fù)制代碼 代碼如下:

<script>
function check() {
      var select = document.getElementById("select").options[document.getElementById("select").options.selectedIndex].value;
      alert(select);
}
</script>

<select name="select" id="select">
<option value="test1" selected="selected">Test1</option>
<option value="test2">Test2</option>
</select>
<input type="button" value="我要試試" onclick="check()"/>

相關(guān)文章

最新評論

吉水县| 赞皇县| 改则县| 翁牛特旗| 天等县| 寿光市| 专栏| 来宾市| 遂宁市| 苍南县| 浮山县| 德州市| 双江| 茶陵县| 石河子市| 阳山县| 永昌县| 玉溪市| 广德县| 崇仁县| 伊宁县| 阳东县| 宿松县| 抚松县| 隆化县| 晴隆县| 泸溪县| 吴川市| 乐陵市| 民乐县| 张家界市| 云和县| 托里县| 菏泽市| 苍南县| 会理县| 凭祥市| 湾仔区| 宣城市| 崇州市| 高淳县|