[align=left][size=large]
----------------------------------------------------------
//[color=red][b]第一种方法:存在不足之处[/b][/color]
//全选、反选、取消
//全选
function selectAll() {
for (i = 0; i < document.form.missiveType.length; i++) {
if (!document.form.missiveType[i].checked) {
document.form.missiveType[i].checked = true;
}
}
}
//反选
function selectRerverse() {
for (i = 0; i < document.form.missiveType.length; i++) {
if (document.form.missiveType[i].checked) {
document.form.missiveType[i].checked = false;
} else {
document.form.missiveType[i].checked = true;
}
}
}
//取消
function cancelAll() {
for (i = 0; i < document.form.missiveType.length; i++) {
if (document.form.missiveType[i].checked) {
document.form.missiveType[i].checked = false;
}
}
}
---------------------------------------------------
[color=red][b]第二种方法:较好[/b][/color]
//全选、反选、取消
//全选
function selectAll() {
var es=document.getElementsByName("missiveType");
for (i = 0; i < es.length; i++) {
if (!es[i].checked) {
es[i].checked = true;
}
}
}
//反选
function selectRerverse() {
var es=document.getElementsByName("missiveType");
for (i = 0; i < es.length; i++) {
if (es[i].checked) {
es[i].checked = false;
} else {
es[i].checked = true;
}
}
}
//取消
function cancelAll() {
var es=document.getElementsByName("missiveType");
for (i = 0; i < es.length; i++) {
if (es[i].checked) {
es[i].checked = false;
}
}
}
[/size][/align]
----------------------------------------------------------
//[color=red][b]第一种方法:存在不足之处[/b][/color]
//全选、反选、取消
//全选
function selectAll() {
for (i = 0; i < document.form.missiveType.length; i++) {
if (!document.form.missiveType[i].checked) {
document.form.missiveType[i].checked = true;
}
}
}
//反选
function selectRerverse() {
for (i = 0; i < document.form.missiveType.length; i++) {
if (document.form.missiveType[i].checked) {
document.form.missiveType[i].checked = false;
} else {
document.form.missiveType[i].checked = true;
}
}
}
//取消
function cancelAll() {
for (i = 0; i < document.form.missiveType.length; i++) {
if (document.form.missiveType[i].checked) {
document.form.missiveType[i].checked = false;
}
}
}
---------------------------------------------------
[color=red][b]第二种方法:较好[/b][/color]
//全选、反选、取消
//全选
function selectAll() {
var es=document.getElementsByName("missiveType");
for (i = 0; i < es.length; i++) {
if (!es[i].checked) {
es[i].checked = true;
}
}
}
//反选
function selectRerverse() {
var es=document.getElementsByName("missiveType");
for (i = 0; i < es.length; i++) {
if (es[i].checked) {
es[i].checked = false;
} else {
es[i].checked = true;
}
}
}
//取消
function cancelAll() {
var es=document.getElementsByName("missiveType");
for (i = 0; i < es.length; i++) {
if (es[i].checked) {
es[i].checked = false;
}
}
}
[/size][/align]