To achieve such a basic requirement, the page has a lot of data, you can delete one or more, before deleting to determine whether to select at least one, otherwise prompt.
functionDeleteUser () { //was trying to save the content in a str+= "" way, but no . //var str; varArray =NewArray ();//The ID used to save the selected data varFlag//determine if a non-selected$ ("Input[name= ' Selectflag ']:checkbox"). each (function() {//iterate through all the checkboxes with name Selectflag if($( This). attr ("checked")) {//decide whether to selectFlag =true;//as long as there is a selection set to True } }) if(flag) {$ ("Input[name= ' Selectflag ']:checkbox"). each (function() {//iterate through all the checkboxes with name Selectflag if($( This). attr ("checked")) {//decide whether to select //alert (This). Val ());Array.push ($ ( This). Val ());//Add the selected value to the array //str+=$ (This). Val () + ","; } }) //pass data that is being collectively deleted to action processingWindow.self.location = "deleteuser?info=" +Array;}Else {Alert ("Please select at least one user"); }}
Background action to receive data for deletion
Public String Execute () throws Exception { //TODO auto-generated Method Stub //The foreground is the first to decompose the string in a,b,c formatString s[] = Info.split (","); /** for (int i=0;i<s.length;i++) {System.out.println (s[i]);} */ if(S.length > 0) { for(inti = 0; i < s.length; i++) {Userdao.deleteuser (S[i]); } } return"Success";}
jquery check box checkbox for delete