1、JavaScript全选: function selectAll(){ var obj = document.fom.elements; for (var i=0;i<obj.length;i++){ if (obj[i].name == "delid"){ obj[i].checked = true; } } } 2、JavaScript全不选: function unselectAll(){ var obj = document.fom.elements; for (var i=0;i<obj.length;i++){ if (obj[i].name == "delid"){ if (obj[i].checked==true) obj[i].checked = false; else obj[i].checked = true; } } }