js禁止表单重复提交

作者:袖梨 2022-11-14

 
  
  
  
  
  
 
  
 
   
 
  
  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();
 
  }
 
  
 
  

相关文章

精彩推荐