js指定时间5秒之内禁止重复提交代码实例。
- <script language=”javascript”>
- var checkSubmitFlg = false;
- function checkSubmit() {
- if (checkSubmitFlg == true) {
- alert(“正在查询中..”);
- return false;
- }
- checkSubmitFlg = true;
- setTimeout(function() {
- checkSubmitFlg = false;
- }, 5000);
- return true;
- }
- </script>
- <form method=post action=”/search.jsp#m” target=”_blank”
- onsubmit=”return checkSubmit();”>
- <input value=”小说城” type=”text” name=”name” size=”35″ maxlength=”10″>
- <input type=”submit” id=”submitInput”/>
- </form>
<script language="javascript">
var checkSubmitFlg = false;
function checkSubmit() {
if (checkSubmitFlg == true) {
alert("正在查询中..");
return false;
}
checkSubmitFlg = true;
setTimeout(function() {
checkSubmitFlg = false;
}, 5000);
return true;
}
</script>
<form method=post action="/search.jsp#m" target="_blank"
onsubmit="return checkSubmit();">
<input value="小说城" type="text" name="name" size="35" maxlength="10">
<input type="submit" id="submitInput"/>
</form>
