A string contains the functions and parameters to be executed and needs to be executed. Run the following command in JS:
<Script language = "JavaScript">
Function Test (STR ){
Alert (STR );
}
Window['Test'] ('aaaaaaaaaaaaaaaaaaaaaaaaa ');
</SCRIPT>
-------------------------------
Method 1...
<Script language = "JavaScript">
Function Test (STR ){
Alert (STR );
}
Eval('Test ("aaaaaaaaaaaaaaaaaaa ")');
</SCRIPT>
------------------------------------
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
$ (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 );
}
}
})
})