<input><br> <br><input><br> <br><input><br> <br><input><br> <br><input><br><br> <br><input>全选与不全选的切换 <br><br><script> <BR>function checkAll(e, itemName) <BR>{ <BR> var aa = document.getElementsByName(itemName); <BR> for (var i=0; i<aa.length; i++) <BR> aa[i].checked = e.checked; <BR>} <BR>function checkItem(e, allName) <BR>{ <BR> var all = document.getElementsByName(allName)[0]; <BR> if(!e.checked) all.checked = false; <BR> else <BR> { <BR> var aa = document.getElementsByName(e.name); <BR> for (var i=0; i<aa.length; i++) <BR> if(!aa[i].checked) return; <BR> all.checked = true; <BR> } <BR>} <BR></script> <br><br> ps:(当然若那个全选框是其它的控件比如是一个按钮,或者一个链接什么的话,那复选框里的 checkItem 点击事件可以去掉,以免出错) <br>