ITeye博客

js 5秒之内禁止重复提交代码

windpoplar · 2017-02-19 20:31 · web开发 · 互联网 · Markdown

  1. <script language="javascript">
  2. var checkSubmitFlg = false;
  3. function checkSubmit() {
  4. if (checkSubmitFlg == true) {
  5. alert("正在查询中..");
  6. return false;
  7. }
  8. checkSubmitFlg = true;
  9. setTimeout(function() {
  10. checkSubmitFlg = false;
  11. }, 5000);
  12. return true;
  13. }
  14. </script>
  15. <form method=post action="/search.jsp#m" target="_blank"
  16. onsubmit="return checkSubmit();">
  17. <input value="小说城" type="text" name="name" size="35" maxlength="10">
  18. <input type="submit" id="submitInput"/>
  19. </form>

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。