文章摘要
本文介绍了使用FCKeditor API进行操作的三个主要功能。第一个功能是`getEditorHTMLContents`,用于获取编辑器中的HTML内容;第二个功能是`getEditorTextContents`,用于获取编辑器中的文字内容;第三个功能是`SetEditorContents`,用于将给定的内容设置到编辑器中。这些方法通过`FCKeditorAPI`获取编辑器对象,并分别使用`GetXHTML`、`EditorDocument.body.innerText`和`SetHTML`方法来实现操作。文章简要概述了FCKeditor API的核心功能,为开发者提供了基本的代码示例。
获取编辑器中HTML内容
复制代码 代码如下:
function getEditorHTMLContents(EditorName)
{
var oEditor=FCKeditorAPI.GetInstance(EditorName);
return(oEditor.GetXHTML(true));
}
获取编辑器中文字内容
复制代码 代码如下:
function getEditorTextContents(EditorName)
{
var oEditor=FCKeditorAPI.GetInstance(EditorName);
return(oEditor.EditorDocument.body.innerText);
}
设置编辑器中内容
复制代码 代码如下:
function SetEditorContents(EditorName, ContentStr)
{
var oEditor=FCKeditorAPI.GetInstance(EditorName) ;
oEditor.SetHTML(ContentStr) ;
}
FCKeditor 插件开发
您可能感兴趣的文章:JS操作Fckeditor的一些常用方法(获取、插入等)CKEditor无法验证的解决方案(js验证+jQuery Validate验证)javascript获取ckeditor编辑器的值(实现代码)FCKeditorAPI 手册 js操作获取等fckeditor常用Js,获取fckeditor内容,统计fckeditor字数,向fckeditor写入指定代码FCKEditor常用Js代码,获取FCK内容,统计FCK字数,向FCK写入指定代码FCKeditor提供了一个完整的JavaScript APIJavaScript 使用Ckeditor+Ckfinder文件上传案例详解
© 版权声明
文章版权归作者所有,未经允许请勿转载。