This article introduces how to use JS + JSP to achieve full checkBox selection. The following is a good example. If you are interested, refer
The Code is as follows:
Script
Function func (){
Var options = document. getElementsByName ("chkBox ");
For (var I = 0; I If (! Options [I]. disabled ){
Options [I]. checked = true;
}
}
}
Script
Use javascript.
The Code is as follows:
Script
Function kk (){
Var handleEl = document. getElementById ("kkHandler ");
Var els = document. getElementsByName ("kk ");
For (I = 0; I Els [I]. checked = handleEl. checked;
}
}
Script
Select All
2:
The Code is as follows:
Script
Function selectAll ()
{
If (! Document. form. id. length ){
If (document. form. chose. checked ){
Document. form. id. checked = true;
}
Else {
Document. form. id. checked = false;
}
}
Else {
For (var I = 0; I If (document. form. chose. checked ){
Document. form. id [I]. checked = true;
}
Else {
Document. form. id [I]. checked = false;
}
}
}
}
Script
3:
The Code is as follows:
Script
Function check_all (){
Arr = document. getElementsByName ('info ');
For (I = 0; iarr [I]. checked = true;
}
}
Script