<meta charset=gb2312> <script language="javascript"> function selectAll() { for(var i=0;i<document.form1.range.length;i++) { document.form1.range[i].checked=true; } } function unSelect() { for(var i=0;i<document.form1.range.length;i++) { if(document.form1.range[i].checked) { document.form1.range[i].checked=false; } else { document.form1.range[i].checked=true; } } } </script> <form name="form1" id="form1"> <input type="checkbox" value="1" name="range">1<br> <input type="checkbox" value="2" name="range">2<br> <input type="checkbox" value="3" name="range">3<br> <input type="checkbox" value="4" name="range">4<br> <input type="checkbox" value="5" name="range">5<br> <input type="button" value="全选" onclick="selectAll();"> <input type="button" value="反选" onclick="unSelect();"> </form>