<script Language=@#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>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<form name=formsubmitf id ="the" method="post" action="XXX.asp">
<input type=hidden name=@#mypretime@# value=@#0@#> //这句不能少,用隐含变量传递一个时间初值
//这里是你要提交的内容
<input type="button" value="写好了" name="button1" class="4round" onclick=@#formsubmit()@#> <font class="red">(请按一次,耐心等待!)</font> <input type="reset" value="重 写" name="button2" class="4round">
</form>
用了这个代码,论坛的重复帖子明显减少,不过有个缺点,就是刷新一次,检测就不起作用,好处就是利用JS检测,不需要额外的权限支持,至于效果如何,用不用就随你们了,(最好前端跟后端都加上检测)
延伸阅读
文章来源于领测软件测试网 https://www.ltesting.net/