碧海潮声大学生网

标题: 〖原创〗〖pw_小hack〗提交按钮后自动禁用,以免重复发帖 [打印本页]

作者: 笨笨啊    时间: 2005-11-20 23:40
标题: 〖原创〗〖pw_小hack〗提交按钮后自动禁用,以免重复发帖
phpwind默认的可能会造成自动重复发帖的(双击提交按钮)

而现在看看我的站点?点击之后是会自动禁用的,直到提交完成

实现方法

修改文件:fastpost.htm
找到
function checkCnt() {

将这个函数修改为
  1. function checkCnt() {
  2.   
  3.   this.document.FORM.Submit.disabled="disabled";
  4.   this.document.FORM.Submit.value="正在提交中……";
  5.   this.document.FORM.submit();
  6.   return true;
  7.   /*cnt++;
  8.   if (cnt==1) return true;
  9.   alert('Submission Processing. Please Wait');
  10.   return false;
  11.   */
  12. }
复制代码

找到
  1.           if((event.ctrlKey && window.event.keyCode == 13)||(event.altKey && window.event.keyCode == 83))
  2.           {
  3.                         this.document.FORM.submit();
  4.           }
复制代码
修改为
  1.           if((event.ctrlKey && window.event.keyCode == 13)||(event.altKey && window.event.keyCode == 83))
  2.           {
  3.               AddBaoZi();
  4.               this.document.FORM.Submit.disabled="disabled";
  5.               this.document.FORM.Submit.value="正在提交中……";
  6.               this.document.FORM.submit();
  7.           }
复制代码

post.htm里的修改方法类似,只要在

同样是替换前面的那个函数为
  1. function checkCnt() {
  2.   this.document.FORM.Submit.disabled="disabled";
  3.   this.document.FORM.Submit.value="正在提交中……";
  4.   this.document.FORM.submit();
  5.   return true;
  6. /* cnt++;
  7.   if (cnt==1) return true;
  8.   
  9.   alert('正在提交中,请稍等…………');
  10.   return false;
  11.   */
  12. }
复制代码
就行了

这样就解决了有时点击提交按钮过快而导致的发两者或重复发帖现象了
作者: 小懒车    时间: 2005-11-21 11:22
嗯 ,好啊!`
收藏了
作者: 笨笨啊    时间: 2005-11-21 12:47
这个功能其实在很多别的地方也用不得,不一定非要这个论坛
作者: LovGate    时间: 2005-11-24 21:44
这个我要了
谢谢楼主啊

不过我还没有做 成功

不知道怎么回事
作者: 笨笨啊    时间: 2005-11-24 21:46
…………本地多调试调试就行了




欢迎光临 碧海潮声大学生网 (http://www.zjoubbs.com/) Powered by Discuz! X3.2