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
相关问答:
我在后台调用JavaScript的时候,他是在后台把事件的代码执行一次后在执行JavaScript方法
有什么办法 在执行JavaScript方法的时候停住,在执行后面的代码
不太明白啊,说清楚点吧
就是执行后台代码的时候 ......
后台有一个函数 protected string Fun1(int a, string b)
我想在javascript代码中调用它,怎么做?
function GridBind()
{
var a = 1;
var b='s';
& ......
怎么用javascript控制gridview里的RadioButton
对 gridview findcontrol ,找出RadioButton,
然后,对RadioButton ,的Attribute 增加 JS就可以了。
C# code:
for (int i = 0; i < gd ......
三个数x,y,z 比大小..
var x,y,z,t;
if (x>y)
{t=x;x=y;y=t;} //交换x,y的值
if(x>z)
{t=z;z=x;x=t;}//交换x,z的值
if(y>z)
{t=y;y=z;z=t;}//交换z,y的值
这是 ......
BS/MS degree in Computer Science or equivalent
About 3 ~ 4 years front-end development experience
Be good at Web technologies is a must, be familar with HTML/CSS/Javascript, AJAX & ......