Its principle is: when the Asp.net page is submitted, the validatoronsubmit method (built-in) is called. We use the coverage feature of the js method to replace the built-in validatoronsubmit of the system with our version, then, when validatoronsubmit is executed, all the submit buttons on the page will be blocked (you can also execute your own methods)
// Shield all submission buttons
Function disableothersubmit ()
{
VaR OBJ = event. srcelement;
VaR objs = Document. getelementsbytagname ('input ');
For (VAR I = 0; I <objs. length; I ++)
{
If (objs. type. tolowercase () = 'submit ')
{
Objs. style. Display = 'none ';
}
}
}
// Overwrite the original validatoronsubmit method to prevent two submissions
Function validatoronsubmit (){
If (page_validationactive ){
If (validatorcommonsubmit ()){
Disableothersubmit ();
Return true;
} Else {
Return false;
}
} Else {
Disableothersubmit ();
Return true;
}
}
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service