<!-- 把如下代码加入<body>区域中 -->
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function anyCheck(form) {
var total = 0;
var max = form.ckbox.length;
for (var idx = 0; idx < max; idx++) {
if (eval("document.playlist.ckbox[" + idx + "].checked") == true) {
total += 1;
}
}
alert("你选择了 " + total + " 个选项.");
}
// End -->
</script>
<form method="post" name=playlist>
1<input type=checkbox name=ckbox>
2<input type=checkbox name=ckbox>
3<input type=checkbox name=ckbox>
4<input type=checkbox name=ckbox>
5<input type=checkbox name=ckbox>
6<input type=checkbox name=ckbox>
7<input type=checkbox name=ckbox>
8<input type=checkbox name=ckbox>
9<input type=checkbox name=ckbox>
<p><center><input type=button value="检测选择个数" onClick="anyCheck(this.form)">
</center></form>