esempio:
codice:
<html> 
<head> 
<script language="javascript"> 
function allChk(objForm,on_off){ 
	for (nn=0;nn<objForm.length;nn++) {
		el = objForm.elements[nn];
		if (el.type=="checkbox") 
			el.checked=on_off; 
	}
} 
</script> 
</head> 
<body> 
<form name="FormName" action="" method="get"> 
<input type="checkbox" value="checkbox1" name="r1"> 
<input type="checkbox" value="checkbox2" name="r2"> 
<input type="checkbox" value="checkbox3" name="r3"> 
<input type="checkbox" value="checkbox4" name="r4"> 
<input type="checkbox" value="checkbox5" name="r5"> 
<input type="button" value="on" onclick="allChk(this.form,true)"> 
<input type="button" value="off" onclick="allChk(this.form,false)"> 
</form> 

</body> 
</html>
ciao