防止用户过快的点击提交按钮

test.php

<form method="post" onsubmit="return CheckFormSubmit();" action="Submit.php" target="target_message">
    <div class="ct_msg fl">
	    Country:
	    <input name="txtCountry" type="text" class="msg_txt" placeholder="I'm from ..." /><br />
	    Company Name:
	    <input name="txtCompany" type="text" class="msg_txt" placeholder="I work in ..." /><br />
	    Contact Person:
	    <input name="txtName" type="text" class="msg_txt" placeholder="My name is ..." /><br />
	    E-Mail:<font color="#f67c77">*</font>
	    <input name="txtEmail" type="email" class="msg_txt" placeholder="My email is ..." required /><br />
	    Message:<font color="#f67c77">*</font>
	    <textarea name="txtContent" class="msg_txt2"  placeholder="I want to get the support for..." required /></textarea>
	    <div class="dy_sbk">
	        <input style="float: left;" type="submit" value="提交" id="Button1" class="dy_sb">
	    </div>
	</div>
</form>
<iframe name="target_message" id="target" width="500px" height="300px"></iframe>
<script>
  var IsSubmited = false;
  function CheckFormSubmit()  {
	
   if(IsSubmited==true) return false; //如果为正在提交状态,则不允许再次提交
   IsSubmited = true;   //更改为提交状态
console.log('执行了一次');
   return true;
  }
console.log(IsSubmited);
</script>

Submit.php

<?php 

if( $_POST ){
	var_dump($_POST);
}

 ?>

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值