Code
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Checkbox全选,反选,全不选</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<mce:script language="Javascript"><!--
function cc(N,bool){
var aa = document.getElementById(N).getElementsByTagName("input");
for (var i=0; i<aa.length; i++){
if (aa[i].type=="checkbox")
aa[i].checked = bool==1 ? true : (bool==0 ? false : !aa[i].checked);
}
}
// --></mce:script>
<form id="form1">
<input type=checkbox name=c1><br>
<input type=checkbox name=c2><br>
<input type=checkbox name=c3><br>
<input type=checkbox name=c4><br>
<input type=checkbox name=c5><br>
.<br>
</form>
<a href="javascript:void(0)" mce_href="javascript:void(0)" onClick="cc('form1',1)">全选</a> <a href="javascript:void(0)" mce_href="javascript:void(0)" onClick="cc('form1',0)">全不选</a> <a href="javascript:void(0)" mce_href="javascript:void(0)" onClick="cc('form1',2)">反选</a>
<form id="form2">
<input type=checkbox name=c11><br>
<input type=checkbox name=c12><br>
<input type=checkbox name=c13><br>
<input type=checkbox name=c14><br>
.<br>
</form>
<a href="javascript:void(0)" mce_href="javascript:void(0)" onClick="cc('form2',1)">全选</a> <a href="javascript:void(0)" mce_href="javascript:void(0)" onClick="cc('form2',0)">全不选</a> <a href="javascript:void(0)" mce_href="javascript:void(0)" onClick="cc('form2',2)">反选</a>
<form id="form3">
<input type=checkbox name=c19><br>
<input type=checkbox name=c21><br>
<input type=checkbox name=c31><br>
.<br>
</form>
<a href="javascript:void(0)" mce_href="javascript:void(0)" onClick="cc('form3',1)">全选</a> <a href="javascript:void(0)" mce_href="javascript:void(0)" onClick="cc('form3',0)">全不选</a> <a href="javascript:void(0)" mce_href="javascript:void(0)" onClick="cc('form3',2)">反选</a>
</body>
</html>
在蓝色理想学习的!~~~~
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Checkbox全选,反选,全不选</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<mce:script language="Javascript"><!--
function cc(N,bool){
var aa = document.getElementById(N).getElementsByTagName("input");
for (var i=0; i<aa.length; i++){
if (aa[i].type=="checkbox")
aa[i].checked = bool==1 ? true : (bool==0 ? false : !aa[i].checked);
}
}
// --></mce:script>
<form id="form1">
<input type=checkbox name=c1><br>
<input type=checkbox name=c2><br>
<input type=checkbox name=c3><br>
<input type=checkbox name=c4><br>
<input type=checkbox name=c5><br>
.<br>
</form>
<a href="javascript:void(0)" mce_href="javascript:void(0)" onClick="cc('form1',1)">全选</a> <a href="javascript:void(0)" mce_href="javascript:void(0)" onClick="cc('form1',0)">全不选</a> <a href="javascript:void(0)" mce_href="javascript:void(0)" onClick="cc('form1',2)">反选</a>
<form id="form2">
<input type=checkbox name=c11><br>
<input type=checkbox name=c12><br>
<input type=checkbox name=c13><br>
<input type=checkbox name=c14><br>
.<br>
</form>
<a href="javascript:void(0)" mce_href="javascript:void(0)" onClick="cc('form2',1)">全选</a> <a href="javascript:void(0)" mce_href="javascript:void(0)" onClick="cc('form2',0)">全不选</a> <a href="javascript:void(0)" mce_href="javascript:void(0)" onClick="cc('form2',2)">反选</a>
<form id="form3">
<input type=checkbox name=c19><br>
<input type=checkbox name=c21><br>
<input type=checkbox name=c31><br>
.<br>
</form>
<a href="javascript:void(0)" mce_href="javascript:void(0)" onClick="cc('form3',1)">全选</a> <a href="javascript:void(0)" mce_href="javascript:void(0)" onClick="cc('form3',0)">全不选</a> <a href="javascript:void(0)" mce_href="javascript:void(0)" onClick="cc('form3',2)">反选</a>
</body>
</html>