如何使用JS调用Fckeditor的获取和插入等常用功能?

更新于
2026-09-27 00:41:58
0阅读来源:SEO资源
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计2533个文字,预计阅读时间需要11分钟。

如何使用JS调用Fckeditor的获取和插入等常用功能?

获取和设置FCKeditor内容,使用JavaScript既方便又常见,例如:

javascript// 获取编辑器中的HTML内容function getEditorHTMLContents(EditorName) { var oEditor=FCKeditorAPI.GetInstance(EditorName);}

javascript获取和设置FCKeditor内容

利用Javascript取和设FCKeditor值也是非常容易的,如下:

// 获取编辑器中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) ; }

FCKeditorAPI是FCKeditor加载后注册的一个全局对象,利用它我们就可以完成对编辑器的各种操作。

阅读全文

本文共计2533个文字,预计阅读时间需要11分钟。

如何使用JS调用Fckeditor的获取和插入等常用功能?

获取和设置FCKeditor内容,使用JavaScript既方便又常见,例如:

javascript// 获取编辑器中的HTML内容function getEditorHTMLContents(EditorName) { var oEditor=FCKeditorAPI.GetInstance(EditorName);}

javascript获取和设置FCKeditor内容

利用Javascript取和设FCKeditor值也是非常容易的,如下:

// 获取编辑器中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) ; }

FCKeditorAPI是FCKeditor加载后注册的一个全局对象,利用它我们就可以完成对编辑器的各种操作。

阅读全文