Front-end Code
Copy code The Code is as follows: <SCRIPT type = "text/JavaScript">
VaR;
Function checkall (){
If (A = 1)
{
For (VAR I = 0; I <symbol Doc ument. form1.elements. length; I ++)
{
VaR E = form1.elements [I];
E. Checked = false;
}
A = 0;
}
Else
{
For (VAR I = 0; I <symbol Doc ument. form1.elements. length; I ++)
{
VaR E = form1.elements [I];
E. Checked = true;
}
A = 1;
}
}
Function checkdel (){
VaR number = 0;
For (VAR I = 0; I <symbol Doc ument. form1.elements. length; I ++)
{
VaR E = form1.elements [I];
If (E. Name! = "Checkboxall ")
{
If (E. Checked = true)
{
Number = Number + 1;
}
}
}
If (number = 0)
{
Alert ("select the item to be deleted! ");
Return false;
}
If (window. Confirm ("are you sure you want to delete it? "))
{
Return true;
}
Else
{
Return false;
}
}
<Asp: linkbutton id = "lbdelete" runat = "server" onclientclick = "javascript: Return checkdel ();" onclick = "lbdelete_click">
Delete </ASP: linkbutton>
<Input id = "checkboxall" type = "checkbox" onclick = "checkall ()"/>
<Input id = "checkbox" name = "menuid" type = "checkbox" value = "<% # eval (" menu_id ") %>"/>
Background codeCopy codeThe Code is as follows: // Delete menu Information
Protected void lbdelete_click (Object sender, eventargs E)
{
Zztj. BLL. sysmenuinfo list = new zztj. BLL. sysmenuinfo ();
List. Delete (request. Form ["menuid"]. tostring ());
Bindmenus ();
}