JavaScript获取Select当前值写法:
var value = document.getElementById("select").options[document.getElementById("select").options.selectedIndex].value;
var text = document.getElementById("select").options[document.getElementById("select").options.selectedIndex].text;
例子:
<select name="select" id="select">
<option value="test1" selected="selected">Test1</option>
<option value="test2">Test2</option>
</select>
<input type="button" value="我要试试" onclick="check()"/>
新闻热点
疑难解答