Program Introduction:
1. Method One: Hiddenform hidden form method: View function Hiddenform
2. Method Two: Disbuttons Disable button method: View function Disbuttons disButtons2
3. This procedure for the client JavaScript program limit multiple submissions, glaciers original blue ideal, welcome to reprint, but please retain my information, thank you
4. Source code posted in my mobile phone theme station: Http://www.qumiao.com/javascript/disRepSubmit.rar (I all original procedures are packaged in this)
5. Author Mailbox and qq:binghe6218@163.com 369768917 (please remind when you add Friends: Program Exchange)
function Source:
The following is a reference fragment by alixixi.com: function Checkform (frm) { The following line is a common validation judgment if (frm.keyword.value== "") {alert (' "Mobile theme name" cannot be empty '); Frm.keyword.focus (); return false}
In this case, the following function can be performed after validation to prevent form data from being repeatedly submitted Disbuttons (); Function call 1 DisButtons2 (); or function call 2 Hiddenform (frm); or function call 3
} |
/*
Function Name: Hiddenform
Function: Make the form automatically hidden when submitting without affecting the submission of the data
*/
The following is a reference fragment by alixixi.com: function Hiddenform (frm) { Waitstr the prompt that appears during the commit process, you can set the var waitstr = "<center> waiting...</center>"; frm.innerhtml = "<div style= ' Display:none; ' > "+frm.innerhtml+" </div> "+WAITSTR; } |
/*
Function Name: disbuttons
function function: Before committing, disable the button,reset,submit in all forms disabled;
If it is a submit button, add the same hidden text box hidden object so that the submitted information does not slip through
Author: Glacier
*/
The following is a reference fragment by alixixi.com: function Disbuttons () { for (k=0;k<document.all.length;k++) { var obj = document.all (k) if (obj.type== ' button ' | | | obj.type== ' Submit ' | | | obj.type== ' reset ') { Obj.disabled = True if (obj.type== ' submit ') { var onewnode = document.createelement ("input"); Onewnode.type = "hidden" Onewnode.name = Obj.name Onewnode.value = Obj.value Frm.insertadjacentelement ("BeforeEnd", Onewnode); Obj.insertadjacentelement ("Afterend", Onewnode); } } } } |
/*
Function Name: disButtons2
function function: Before committing, disable the button,reset,submit in all forms disabled;
If it is a submit button, add the same hidden text box hidden object so that the submitted information does not slip through
Author: Glacier
Function Description: Like the function above, but the scope of the browser is wider, it is recommended to use this function.
*/
The following is a reference fragment: function DisButtons2 () { for (k=0;k<document.forms.length;k++) { var frm = document.forms[k] for (i=0;i<frm.length;i++) { var obj = frm.elements[i] if (obj.type== ' button ' | | | obj.type== ' Submit ' | | | obj.type== ' reset ') { Obj.disabled = True if (obj.type== ' submit ') { var onewnode = document.createelement ("input"); Onewnode.type = "hidden" Onewnode.name = Obj.name Onewnode.value = Obj.value Frm.insertadjacentelement ("BeforeEnd", Onewnode); Obj.insertadjacentelement ("Afterend", Onewnode); } } } } } |