See the following two implementation methods:
JS checkbox Method 1:
CopyCode The Code is as follows: function checkall ()
{
VaR code_values = Document. All ['Code _ value'];
If (code_values.length ){
For (VAR I = 0; I <code_values.length; I ++)
{
Code_values [I]. Checked = true;
}
} Else {
Code_values.checked = true;
}
}
Function uncheckall ()
{
VaR code_values = Document. All ['Code _ value'];
If (code_values.length ){
For (VAR I = 0; I <code_values.length; I ++)
{
Code_values [I]. Checked = false;
}
} Else {
Code_values.checked = false;
}
}
Function multipledelete ()
{
VaR num = 0;
VaR code_values = Document. All ['Code _ value'];
If (code_values.length ){
For (VAR I = 0; I <code_values.length; I ++)
{
If (code_values [I]. Checked = true)
{
Num ++;
}
}
} Else {
If (code_values.checked = true ){
Num ++;
}
}
If (num = 0 ){
Alert ('Please select Delete item ');
}
If (Num> 0 ){
Document. bucodesearch. Action = '<% = eusutil. getpage ("lookup. Generic. bucode. Delete. s") %> ';
Document. bucodesearch. Submit ();
}
}
</SCRIPT>
JS checkbox Method 2:
Copy code The Code is as follows: function checkall ()
{
VaR code_values = Document. getelementsbytagname ("input ");
For (I = 0; I <code_values.length; I ++ ){
If (code_values [I]. type = "checkbox ")
{
Code_values [I]. Checked = true;
}
}
}
Function uncheckall ()
{
VaR code_values = Document. getelementsbytagname ("input ");
For (I = 0; I <code_values.length; I ++ ){
If (code_values [I]. type = "checkbox ")
{
Code_values [I]. Checked = false;
}
}
}
Function multipledelete ()
{
If (document. bucodesearch. elements ["code_value"])
{
VaR num = 0;
VaR fm = Document. bucodesearch;
If (document. bucodesearch. elements ["code_value"])
{
VaR elm = Document. bucodesearch. elements ["code_value"];
VaR ename = "code_value ";
If (ELM. Length ){
VaR Len = FM. elements [ename]. length;
For (VAR I = 0; I <Len; I ++ ){
VaR E = FM. elements [ename] [I];
If (E. Checked = true ){
Num ++;
}
}
} Else {
If (ELM. Checked = true ){
Num ++;
}
}
If (Num> 0)
{
Document. bucodesearch. Action = '<% = eusutil. getpage ("lookup. Generic. bucode. Delete. s") %> ';
Document. bucodesearch. Submit ();
}
}
}
}
Code_value is the name of the checkbox form, and bucodesearch is the form name.Copy codeThe Code is as follows: <TD align = "Left" width = "20"> <input type = "checkbox" name = "code_value" value = "<% = userdeffieldvaluebean. getudfvalue () %> "> </TD>