<DOCTYPEhtml> <html> <BODYBGCOLOR="#FFFFFF"> <formname='formsubmitf'id="the"method="post"action="XXX.php"> <inputtype='hidden'name='mypretime'value='0'> <inputtype="button"value="写好了"name="button1"class="4round"onclick='formsubmit()'> </form> <scriptLanguage='JavaScript'> function formsubmit() { Today = new Date(); var NowHour = Today.getHours(); var NowMinute = Today.getMinutes(); var NowSecond = Today.getSeconds(); var mysec = (NowHour*3600)+(NowMinute*60)+NowSecond; if((mysec-document.formsubmitf.mypretime.value)>600){ //600只是一个时间值,就是5分钟内禁止重复提交,值随便 document.formsubmitf.mypretime.value=mysec; } else{ alert(' 按一次就够了,请勿重复提交!请耐心等待!谢谢合作!'); return false; } document.forms.formsubmitf.submit(); } </script> </html>
相信看了本文案例你已经掌握了方法,更多精彩请关注php中文网其它相关文章!
推荐阅读:
Atas ialah kandungan terperinci js如何设置禁止表单重复提交. Untuk maklumat lanjut, sila ikut artikel berkaitan lain di laman web China PHP!