JS代码如下:
<script language="javascript">
function sel(a) {
o = document.getElementsByName(a)
for (i = 0; i < o.length; i++)
o[i].checked = event.srcElement.checked
}
</script>
JSP代码如下:
<input type=checkbox onclick=sel('chk')>
//全选框
<input type=checkbox name=chk>
<input type=checkbox name=chk>
<input type=checkbox name=chk>
<input type=checkbox name=chk>
<input type=checkbox name=chk>
<input type=checkbox name=chk>