JavaScript获取选中项
<script type="text/javascript">
function show(){
var ListUtil=new Object();
var ListUtil.getSelectedIndexes=function (oListbox){
var arrIndexes=new Array;
for(var i=0;i <oListbox.length;i++){
if(oListbox.options[i].selected){
arrIndexes.push[i];
}
}
return arrIndexes;
};
var oListbox=document.getElementById("selAge");
var arrIndexes=ListUtil.getSelectedIndexes(oListbox);
alert("There are"+arrIndexes.length+"option selected."+"The options have the indexes"+arrIndexes+".");
}
</script>
</head>
<body onload="show()">
<select name="selAge" id="selAge" size="3" multiple="multiple">
<option value="1" >18-21 </option>
<option value="2" selected="selected">22-25 </option>
<option value="3" selected="selected">26-29 </option>
<option value="4">30-35 </option>
<option value="5">Over 35 </option>
</select>
</body>这段代码怎么报错missing:before statement和show
is not defined
相关问答:
这是我的文本框
<input type="text" size="60" name="password_answer" id="pwdanswer" value="$!password_answer" >
提交按钮
<input clas ......
怎么用javascript控制gridview里的RadioButton
对 gridview findcontrol ,找出RadioButton,
然后,对RadioButton ,的Attribute 增加 JS就可以了。
C# code:
for (int i = 0; i < gd ......
<script type="text/javascript">
function IsValidate()
{
var flag=false;
var cellPartN ......
<html>
<head>
<title></title>
</head>
<body>
<font color="#0000FF"><b>请在文本框1中输入文字:</b>
<form>
<input ......