找回密码

碧海潮声大学生网

查看: 1178|回复: 4
打印 上一主题 下一主题

〖原创〗〖pw_小hack〗提交按钮后自动禁用,以免重复发帖

[复制链接]
跳转到指定楼层
1#
发表于 2005-11-20 23:40 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
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. }
复制代码
就行了

这样就解决了有时点击提交按钮过快而导致的发两者或重复发帖现象了
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享分享 顶 踩
2#
发表于 2005-11-21 11:22 | 只看该作者
嗯 ,好啊!`
收藏了
3#
 楼主| 发表于 2005-11-21 12:47 | 只看该作者
这个功能其实在很多别的地方也用不得,不一定非要这个论坛
4#
发表于 2005-11-24 21:44 | 只看该作者
这个我要了
谢谢楼主啊

不过我还没有做 成功

不知道怎么回事
5#
 楼主| 发表于 2005-11-24 21:46 | 只看该作者
…………本地多调试调试就行了
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|小黑屋| 碧海潮声大学生网  

Copyright © 2001-2013 Comsenz Inc.   All Rights Reserved.

Powered by Discuz! X3.2( 浙ICP备11026473号 )

快速回复 返回顶部 返回列表