And use js to execute:
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]
-------------------------------
Method 1...
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]
This is method 2 ....
The function to be executed is set in the value of the checkbox, and the method parameter is to pass the checkbox currently clicked as the parameter.
Here I use large jquery for operations
Copy codeThe Code is as follows:
$ (Function (){
$ ("Ul li a" ).css ("cursor", "pointer ");
$ ("Ul li a"). click (function (){
Var $ ck = $ (this). siblings (": checkbox ");
If ($ ck. attr ("name") = "total") // select all
{
If ($ ck. attr ("checked") = false ){
$ Ck. attr ("checked", "checked ");
$ ("[Name = 'ck ']: checkbox"). attr ("checked", "checked ");
Var ff = $ ck. val (); // gets the string of the function to be executed
Var cc = $ ck. get (0); // converts a jquery object to a DOM object.
Window [ff] (cc); // execute the string function and pass the current checkbox object as a parameter
}
Else {
$ Ck. attr ("checked ","");
$ ("[Name = 'ck ']: checkbox"). attr ("checked ","");
Var ff = $ ck. val ();
Var cc = $ ck. get (0 );
Window [ff] (cc );
}
}
Else // select one
{
If ($ ck. attr ("checked") = false ){
$ Ck. attr ("checked", "checked ");
Var s = $ ck. val ();
Var a = $ ck. get (0 );
Window [s] ();
}
Else {
$ Ck. attr ("checked ","");
Var s = $ ck. val ();
Var cb = $ ck. get (0 );
Window [s] (cb );
}
}
})
})