js获取下拉列表的值和元素个数示例

时间:2014-05-07    点击:137   

js获取下拉列表框元素的个数

复制代码 代码如下:

<!DOCTYPE html>
<html>
<head>
<script>
function getLength()
{
alert(document.getElementById("mySelect").length);//元素个数
}
</script>
</head>
<body>

<form>
<select id="mySelect">
  <option>Apple</option>
  <option>Pear</option>
  <option>Banana</option>
  <option>Orange</option>
</select>
<input type="button" onclick="getLength()" value="How many options in the list?">
</form>

</body>
</html>

jquery 显示*天*时*分*秒实现时间计时器
解决jQuery动态获取手机屏幕高和宽的问题
addEventListener 的用法示例介绍
jquery通过select列表选择框对表格数据进行过滤示例
关闭时刷新父窗口两种方法
> 返回     
地址:上海市普陀区胶州路941号长久商务中心 电话: QQ:
© Copyright 2012 上海网络 Product All Rights Reserved