Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[插件] 自动检查输入的字数 for D4.0

[复制链接]
haohao036 发表于 2005-12-17 23:40:16 | 显示全部楼层 |阅读模式
作者:lu5266

我只是从2.5转成4.0

只是修改模板  post_newthread.htm   post_editpost.htm  post_newreply.htm  )

post_newthread.htm查找:

  1.         }                       
  2.         theform.topicsubmit.disabled = true;
  3.         return true;
  4. }
复制代码


post_editpost.htm 的是:

  1.         }
  2.         theform.editsubmit.disabled = true;
  3.         return true;
  4. }
复制代码


post_newreply.htm  的是:

  1.         }                       
  2.         theform.replysubmit.disabled = true;
  3.         return true;
  4. }
复制代码


后面加上

  1. function showleave() {
  2. if (postmaxchars != 0)  in_message = "   限制:<b><font face="Gulim" color="#808000">"+postminchars+"--"+postmaxchars+"</font></b> 字节"; else in_message = "";
  3. nowtxt=document.input.message.value;  nowtxt=nowtxt.replace(/[^\x00-\xff]/g,"ab").length; leavetxt=eval(postmaxchars-nowtxt);
  4. if(leavetxt==0) alert(" 你输入的字数已达到限制个数:"+postmaxchars);
  5. if(leavetxt<0) alert(" 你输入的字数超过限制个数: 超出"+eval(nowtxt-postmaxchars)+"个");
  6. document.getElementById('show_leave').innerHTML= "当前:<b><font face="Gulim" color="#FF0000">"+nowtxt+" </font></b>字节. 剩余:<b><font face="Gulim" color="blue">"+leavetxt+"</font></b>   字节"+in_message;
  7. }
复制代码


查找:

  1. <td align="left" class="altbg2"><span class="smalltxt">
复制代码


其他的两个(post_editpost.htm  post_newreply.htm  )的是:

  1. <td class="altbg2"><span class="smalltxt">
复制代码


后面加上

  1. <span id=show_leave ></span><br><br>
复制代码


查找:

  1. onKeyUp="javascript: storeCaret(this);
复制代码


后面加上:

  1. showleave();
复制代码




搞定了.

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
linsie 发表于 2005-12-17 23:48:51 | 显示全部楼层
沙发 谢谢
回复

使用道具 举报

jimmyjimmyqqq 发表于 2005-12-17 23:55:22 | 显示全部楼层
板凳!
回复

使用道具 举报

乄有點の拽ヤ 发表于 2005-12-18 12:09:53 | 显示全部楼层
好东西~
回复

使用道具 举报

killua_bo 发表于 2005-12-18 12:17:29 | 显示全部楼层
不错的!!
回复

使用道具 举报

ndren 发表于 2005-12-18 13:41:37 | 显示全部楼层
很人性化,顶,呵。
回复

使用道具 举报

尐強 发表于 2005-12-18 18:29:30 | 显示全部楼层
不错
回复

使用道具 举报

紫云杉 发表于 2005-12-18 19:20:04 | 显示全部楼层
不错
回复

使用道具 举报

eghawk 发表于 2005-12-18 19:22:54 | 显示全部楼层
顶上去
回复

使用道具 举报

tmwz188 发表于 2005-12-18 19:51:27 | 显示全部楼层
这个不错、!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-5-19 02:59 , Processed in 0.102259 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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