手机
当前位置:查字典教程网 >编程开发 >网页编辑器 >Fckeditor编辑器内容长度限制统计实现方法
Fckeditor编辑器内容长度限制统计实现方法
摘要:先我们看最简单的就是编辑器的代码了,简单得很同时大家也经常看过。复制代码代码如下://检测在线编器字符数,他必须通过创建FCKeditorA...

先我们看最简单的就是编辑器的代码了,简单得很同时大家也经常看过。

复制代码 代码如下:

<script type="text/javascript" src="http://www.jb51.neteditor/fckeditor.js"></script>

<script type="text/javascript">

<>

</script>

<input type="button" value="检测字数(包括HTML代码)">

<script>

//检测在线编器字符数 ,他必须通过创建FCKeditorAPI来实现,代码如下。

复制代码 代码如下:

function checklength()

{

var Content;

var oEditor = FCKeditorAPI.GetInstance('Content') ;

Content=oEditor.GetXHTML(true)

alert("n当前: "+Content.length+" 个字符");

return false;

}

</script>

再看实例,这里限制了fckeditor编辑器内容的长度哦,

复制代码 代码如下:

window.onload=function(){

function FCKeditor_OnComplete()

{

var editor = FCKeditorAPI.GetInstance('info') ;

editor.Events.AttachEvent('OnSelectionChange', editor_keydown);

}

function editor_keydown(editor)

{

var maxLength=3; //最大输入字数

content= $(editor.EditorDocument.body).text();

var len= content.length;

var $info =$('#info');//存放提示信息

if(len < maxLength){

.text("还可以输入 "+(maxLength-len)+"字");

}

if(len == maxLength){

$info.text("字数达到上限");

}

if(len > maxLength){

$info.text(" 输入字符超过"+maxLength+"个,请更改!");

}

}

FCKeditor_OnComplete()

}

【Fckeditor编辑器内容长度限制统计实现方法】相关文章:

ASP FCKeditor在线编辑器使用方法

页面上存在多个FckEditor编辑器的验证方法

FCKeditor 图片上传进度条不动的解决方法

dedecms5.5 最新版ckeditor编辑器整合教程

FCKEditor超级链接默认新窗口打开的修改方法

PHP网页 Ewebeditor 编辑器嵌入方法

php下FCKeditor2.6.5网页编辑器的使用方法

KindEditor 4.x 在线编辑器常用方法小结

配置fckeditor 实现图片的上传

FCKeditor 编辑器插入代码功能实现步骤

精品推荐
分类导航