<tr><td onclick=javascript:ActionForm("modify")>Modify current user</td>
<td onclick=javascript:ActionForm("delete")>Delete current user</td></tr>
<td onclick=javascript:ActionForm("delete")>Delete current user</td></tr>
<form name=form1>
<input type="checkbox" name="id[]" value="1">
<input type="checkbox" name="id[]" value="2">
<input type="checkbox" name="id[]" value="3">
<input type="checkbox" name="id[]" value="4">
<input type=button value=test onClick="test()">
</form>
<script language="javascript">
function test() {
s = "";
for(i=0;i<document.form1["id[]"].length;i++)
if(document.form1["id[]"][i].checked)
s += i+":"+document.form1["id[]"][i].value+"\n";
alert(s);
}
</script>
把表单和脚本贴全了,帮你测试一下
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head><body>
<form name="form1" method="post" action="">
<input type="checkbox" name="a[]" value="a">
<input type="checkbox" name="a[]" value="b">
<input type="checkbox" name="a[]" value="c">
<input type="button" name="submit" value="按钮" onClick="num();">
</form>
</body>
<script language="JavaScript">
<!--
function num(){
var b=window.document.forms[0].elements["a[]"].length;
alert(b);
for(var i=0;i<b;i++){
if(window.document.forms[0].elements["a[]"][i].checked){
var c=window.document.forms[0].elements["a[]"][i].value;
alert("你选择了"+c+"!");
}
}
}
-->
</script>
</html>