当前位置:有风信息港IT学院编程技术asp → JSP避免Form重复提交的三种方案

JSP避免Form重复提交的三种方案

减小字体 增大字体 作者:有风IT学院  来源:有风信息港  发布时间:2008-1-13 9:28:37
  1 javascript ,设置一个变量,只允许提交一次。 

  <script language="javascript">

   var checkSubmitFlg = false;

   function checkSubmit() {

   if (checkSubmitFlg == true) {

   return false;

   }

   checkSubmitFlg = true;

   return true;

   }

   document.ondblclick = function docondblclick() {

   window.event.returnValue = false;

   }

   document.onclick = function doconclick() {

   if (checkSubmitFlg) {

   window.event.returnValue = false;

   }

   }

  </script>

  

  <html:form action="myAction.do" method="post" >  

  2 还是javascript,将提交按钮或者image置为disable  

   <html:form action="myAction.do" method="post"

   >   

   <html:image styleId="submitInput" src="/it/UploadPic/2008-1/200811392838789.gif" border="0" /> 

   </html:form>  

  
javascript:window.open(this.src);" style="cursor: pointer;"/>

[1] [2]  下一页