您现在的位置:首页 --> JavaScript --> 用js给fckeditor赋值的办法
用js给fckeditor赋值的办法
浏览:1439次 出处信息
虽然用fckeditor很久了,但是对它并不熟悉,今天就碰到一个问题,就是如何通过js来对已经加载的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) ;
}
QQ技术交流群:445447336,欢迎加入!
扫一扫订阅我的微信号:IT技术博客大学习
扫一扫订阅我的微信号:IT技术博客大学习
<< 前一篇:没有更老的了!,您可返回本栏目:JavaScript
后一篇:JS代码优化的层次 >>
文章信息
- 作者:yoyo 来源: YOYO'S BLOG
- 标签: fckeditor
- 发布时间:2009-10-10 14:09:00
近3天十大热文
- [250] WEB系统需要关注的一些点
- [250] 如何拿下简短的域名
- [11] 大并发下的高性能编程 – 改进的(用户态)自
- [11] 关于身份证号的那些事
- [11] Python中的闭包
- [10] MySQL error log 输出到sys
- [10] 一步一步教你怎样给Apache Spark贡
- [9] 五个实用的Google Analytics过
- [9] [Perl]Moose::Manual::T
- [8] 树莓派(Raspberry Pi)使用小记