欢迎来到3672js教程,我们关注js教程、js框架、js代码特效等。

js获得下拉列表的选项数量用法代码

3672Js.Com2019-03-08 13:47 来源:未知 阅读:13131 关注度5

js获得下拉列表的选项数量用法代码


<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>3672js教程(3672js.com)</title>
<script>
function getLength(){
	alert(document.getElementById("mySelect").length);
}
</script>
</head>
<body>

<form>
<select id="mySelect">
<option>苹果</option>
<option>梨子</option>
<option>香蕉</option>
<option>橙子</option>
</select>
<input type="button" onclick="getLength()" value="列表有几种选择?">
</form>

</body>
</html>

本站文章为3672js教程网友分享投稿,版权归原作者,欢迎任何形式的转载,但请务必注明出处。同时文章内容如有侵犯了您的权益,请联系我们处理。
评论已被关闭
{dede:include filename="foot.htm"/}