在IE中可以获得
在IE中可以获得<select>的length,但在Firefox却不能?
单击“获得”按钮,在IE中显示为3,但是在Firefox中却没有反应,这是什么原因?
------解决思路----------------------
单击“获得”按钮,在IE中显示为3,但是在Firefox中却没有反应,这是什么原因?
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
</head>
<script language="javascript">
function getLength()
{
seletLen=document.getElementById("selectInfo").length
alert(seletLen);
}
</script>
<body>
<div id="outer">
<select name="selectInfo" size="20" style="width:200px;" multiple="multiple" >
<option value="">aaa</option>
<option value="">bbb</option>
<option value="">ccc</option>
</select>
</div>
<input type="button" value="获得" onClick="getLength()">
</body>
</html>
------解决思路----------------------
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
</head>
<script language="javascript">
function getLength()
{
seletLen=document.getElementById("selectInfo").options.length;
alert(seletLen);
}
</script>
<body>
<div id="outer">
<select id="selectInfo" size="20" style="width:200px;" multiple="multiple" >
<option value="">aaa</option>
<option value="">bbb</option>
<option value="">ccc</option>
</select>
</div>
<input type="button" value="获得" onClick="getLength()">
</body>
</html>