1. Disable the submit button after submission (such as csdn)
2. The data is processed successfully and you will be redirected to another page immediately.
Refresh after the operation is indeed a problem. You can use to jump to the page and close this page. If there is a parameter data condition to control it, it should be done well. You can directly modify the window. the value of location to change all the parameter values. The above method is used.
Document. All ("Save _" + idx). Disabled = true;
A brother just asked this question very easily.
On the submitted page, that isDatabaseBefore processing
If SESSION ("JY") = true then
Response. Write "error, submitting"
Response. End
End if
Release the session ("JY") after the database is processed ")
Session ("JY") = false
You can!
Use session or a troublesome method:
Use window. Open to pop up the form input page. Click Submit to close the page;
The ASP page for processing the submission is also displayed, that is, the target of the form is set to "submit_form" first, and the window is displayed when you click Submit. open ("XXX. ASP "," submit_form "), then use js to submit the form, and finally window. close ();
On the ASP page for processing the submitted data, after entering the data to the database, a dialog box is displayed, indicating "submitted successfully" or something. Finally, a window. Close () is displayed ();
Because for Windows. open. when close () is used to close the window, a prompt box will not pop up, and the window will be closed directly, so that the user has no chance to submit it again.
I don't know what this means.
2. If data processing is successful, you will be redirected to another page immediately!
This method is the simplest
(Borrow Principles)
First, we can define a session variable to save the Submission serial number of a form. Here I define it as "$ userlastaction ". Then add a Hidden variable to the form and set the value to $ userlastaction + 1:
<Input type = hidden name = lastaction value = <? = $ Userlastaction + 1?>
Finally, determine whether the form has been submitted before processing and submission:
If ($ lastaction> $ userlastaction and inputisvalid (...)){
$ Userlastaction ++; // Add 1 to the serial number
// Process form data
}
I always use this
Your background processing page, that is, the data receiving page. After performing the relevant operations, use the following statement:
Response. write ("<SCRIPT> alert ('data submitted successfully ****** '); window. location. href = 'address of the page to be redirected '; </SCRIPT> ")
In this way, the dialog box "data submitted successfully ******" is displayed.
Top
Respondent: arcow (Chong xing) () Credit: 100 17:09:40 score: 0
?
<Script. Language = "JavaScript">
<! --
Function input (OK)
{
VaR M1 = OK. replycontent. value;
If (M1 = ''){
Alert ('reply content cannot be blank .');
Return false;
}
OK. b1.disabled = true;
OK. b2.disabled = true;
Return true;
}
// -->
</SCRIPT>
<Form. nsubmit = "Return input (this)">
<Input type = text name = replycontent>
<Input type = "Submit" value = "reply" border = "0" name = "B1">
<Input name = "B2" type = "reset" value = "re-write">
</Form>
In this way, submit and directly go to another page.
1. Submit and return historical records
Response. Write "<SCRIPT> alert ('OK! Added successfully! '); History. Back (); </SCRIPT>"
2. Go to this page after submission
Response. Redirect "index. asp"
Response. Write "<script. Language = JavaScript> alert ('submitted successfully! '); Window. Location. href =' "& request. servervariables (" http_referer ") &" '; </SCRIPT>"
========================================================== ===
Prevent web page bounce
When we add a database, if the database is allowed to be removed and the page is refreshed, the addition operation will be executed again, which is undoubtedly not what we need, as in general, there are a lot of online cache prohibitedCodeSometimes it is not reliable. You only need to add <body nbeforeunload = "window. location. replace ('')"> You can specify the new page to be targeted in the webpage, and then click back to see if it will not return to the previous operation page, actually, this history has been deleted.
======================================
Response. Buffer = true;
Response. expiresabsolute = datetime. Now. addseconds (-1 );
Response. expires = 0;
Response. cachecontrol = "no-Cache ";
============