The jquery method is as follows:
CopyCode The Code is as follows: function checkall (VAL ){
$ ("Input [name = 'chkjob']"). Each (function (){
This. Checked = val;
});
$ ("# Chkall"). ATTR ("checked", Val); // you can specify the status of the Select All button.
}
Val this parameter specifies the selection status of the Select All button.
name = 'chkjob' indicates the checkbox name in the list.
chkall indicates the name of the Select All button.
I like jquery's simplicity and clarity...
it's really a little different from what I wrote with JavaScript!
eg:
select all JavaScript code copy Code the code is as follows: // select all
function checkall () {
var all = document. getelementsbytagname ("input");
for (VAR I = 0; I If (ALL [I]. type = "checkbox") {
All [I]. checked = true;
}< BR >}< br> // reselect
function checknull () {
var all = document. getelementsbytagname ("input");
for (VAR I = 0; I If (ALL [I]. type = "checkbox") {
All [I]. checked = false;
}< BR >}