第一种:用flag标识,下面的代码设置checkSubmitFlg标志:
<script language="”javascript”">
var checkSubmitFlg = false;
function checkSubmit(){
if(checkSubmitFlg ==true){ return false; //当表单被提交过一次后checkSubmitFlg将变为true,根据判断将无法进行提交。
}
checkSubmitFlg ==true;
return true;
}
< /script >
< form name=”form1” method=”post” οnsubmit=”return checkSubmit();”>
………..< /form>
第二种:在onsubmit事件中设置,在第一次提交后使提交按钮失效,代码如下:
<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)
{
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" οnclick='formsubmit()'> <font class="red">(请按一次,耐心等待!)</font> <input type="reset" value="重 写" name="button2" class="4round">
</form>
<script language="”javascript”">
var checkSubmitFlg = false;
function checkSubmit(){
if(checkSubmitFlg ==true){ return false; //当表单被提交过一次后checkSubmitFlg将变为true,根据判断将无法进行提交。
}
checkSubmitFlg ==true;
return true;
}
< /script >
< form name=”form1” method=”post” οnsubmit=”return checkSubmit();”>
………..< /form>
第二种:在onsubmit事件中设置,在第一次提交后使提交按钮失效,代码如下:
<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)
{
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" οnclick='formsubmit()'> <font class="red">(请按一次,耐心等待!)</font> <input type="reset" value="重 写" name="button2" class="4round">
</form>