In Web project development, select and reverse is the most common and basic technology:
Now let the little friends to sum up several small examples:
jquery: The
first method:
$ ("#checkid"). Click (Function () {
if (($ ("#checkid"). attr ("checked")) {
$ (". Chkbox"). attr ("Checked", true);
} else{
$ (". Chkbox"). attr ("checked", false);
}}); The second method:
$ ("#checkAll"). Click (function () {
if ($ ("#checkAll"). Is (": Checked")) {
$ ("Input:checkbox: Not (' #checkAll ')]. each (function () {
$ (this). attr ("Checked", true);
});
else{
$ ("Input:checkbox:not (' #checkAll ')"). each (function () {
// $ (this). attr ("checked", false);
$ (this). Removeattr ("checked");
}
);} JS:
function Check () {
var id=document.getelementbyidx_x ("Checkall");
var name=document.getelementsbyname ("Check");
if (id.checked) {for
(var i=0;i
name[i].checked=true;
}}
} else{for
(var i=0;i
name[i].checked=false;
}
}
}