<script src="test.js"></script>
<form id="form1" name="form1" method="post" action="">
<p>
<label>
<input type="checkbox" name="CheckboxGroup1" value="复选框" id="CheckboxGroup1_0" />
复选框</label>
<br />
<label>
<input type="checkbox" name="CheckboxGroup1" value="复选框" id="CheckboxGroup1_1" />
复选框</label>
<br />
<label>
<input type="checkbox" name="CheckboxGroup1" value="复选框" id="CheckboxGroup1_2" />
复选框</label>
<br />
<label>
<input type="checkbox" name="CheckboxGroup1" value="复选框" id="CheckboxGroup1_3" />
复选框</label>
</p>
<p><a href="javascript:xuan(0);">全选</a> <a href="javascript:xuan(1);">全不选</a> <a href="javascript:xuan(2);">反选</a><br />
</p>
</form>
function xuan(n){
var chk=document.getElementsByName("CheckboxGroup1");
for(var i=0;i<chk.length;i++){
if(n==0){
chk[i].checked=true;
}
else if(n==1){
chk[i].checked=false;
}
else if(n==2){
chk[i].checked=!chk[i].checked;
}
}
}