首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

fck 增添字数统计

2012-11-08 
fck 添加字数统计?div idtextCount/div??? script typetext/javascript? window.onloadfunct

fck 添加字数统计

?<div id="textCount"></div>
??? <script type="text/javascript">
? window.onload=function(){
??? var editors=FCKeditorAPI.GetInstance('body');
??? ?editors.Events.AttachEvent('OnSelectionChange', editor_keydown);
??? ?function editor_keydown(editors){
??? ??? ? var maxLength=420; //最大输入字数
??????? content= $(editors.EditorDocument.body).text();
???? var len= content.length;
??? ??? if(len>420){
??? ??? ??? alert('你已经输入的次数超过420了');return;
??? ??? }
??? var sheng=maxLength-len;???
??? ??? $('#textCount').html("你还可以输入<span style='color:red;'>"+sheng+"</span>个字");
??? ?}
??? //alert(editors);
}

? </script>

热点排行