<input type=checkbox name=mm value=a οnclick="checkItem(this, 'mmAll')"><br> <input type=checkbox name=mm value=b οnclick="checkItem(this, 'mmAll')"><br> <input type=checkbox name=mm value=c οnclick="checkItem(this, 'mmAll')"><br> <input type=checkbox name=mm value=d οnclick="checkItem(this, 'mmAll')"><br> <input type=checkbox name=mm value=e οnclick="checkItem(this, 'mmAll')"><br><br> <input type=checkbox name=mmAll οnclick="checkAll(this, 'mm')">全选与不全选的切换 <mce:script language=Javascript><!-- function checkAll(e, itemName) { var aa = document.getElementsByName(itemName); for (var i=0; i<aa.length; i++) aa[i].checked = e.checked; } function checkItem(e, allName) { var all = document.getElementsByName(allName)[0]; if(!e.checked) all.checked = false; else { var aa = document.getElementsByName(e.name); for (var i=0; i<aa.length; i++) if(!aa[i].checked) return; all.checked = true; } } // --></mce:script> var checkDelAll = function() { var count=0; for(var i=0;i<chooseForm.elements.length;i++) { var e = chooseForm.elements[i]; if (e.type == 'checkbox' && e.checked==true && e.name!='chooseAll') { count++; } } if(count==0){ alert("请选中需要删除的数据"); return false; } if(confirm("确认要删除吗?")){ chooseForm.action = 'deleteUserPhoto.action'; chooseForm.submit(); }else{ return false; } } 如果页面使用 <s:iterator value=""> 同样可以 IE FF 通用