Home > Web Front-end > JS Tutorial > Two ways to prevent repeated submission of forms in js_javascript skills

Two ways to prevent repeated submission of forms in js_javascript skills

WBOY
Release: 2016-05-16 17:20:56
Original
1214 people have browsed it
First type: is marked with flag. The following code sets the checkSubmitFlg flag:
Copy code The code is as follows:



Because the program source code conflicts with the WIN2000 registry, an invalid page will appear after the post is sent. As a result, there are many non-malicious duplicate posts in the forum. Later I came up with a way to use JS to avoid repeated submissions. Here is part of the source code:
Copy the code The code is as follows:







//This sentence cannot be missing, use implicit variables to pass an initial time value

//Here is the content you want to submit

(Please click once , wait patiently! )


Using this code, the number of duplicate posts in the forum has been significantly reduced. However, there is a disadvantage. The detection will not work after refreshing once. The advantage is that it uses JS detection and does not require additional permission support. As for the effect, it depends on whether you use it or not. It’s up to you (it’s best to add detection to both the front-end and back-end)
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template