设为首页收藏本站

全球主机交流论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

搜索
热搜: discuz
查看: 1031|回复: 1
打印 上一主题 下一主题

用js给fckeditor赋值的办法

[复制链接]
  • TA的每日心情
    奋斗
    2016-9-4 22:05
  • 签到天数: 5 天

    [LV.2]偶尔看看I

    跳转到指定楼层
    楼主
    发表于 2014-9-16 18:28:45 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
    虽然用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) ;
    }
    来源:yoyo blog



    分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友 微信微信
    收藏收藏
    回复

    使用道具 举报

    该用户从未签到

    沙发
    发表于 2014-9-17 10:28:48 | 只看该作者
    不错,支持下。
    回复 支持 反对

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    QQ|小黑屋|Archiver|手机版|中国U网    

    GMT+8, 2024-5-1 00:17 , Processed in 0.069131 second(s), 20 queries .

    Powered by Discuz! X3.2

    © 2001-2013 Comsenz Inc.

    快速回复 返回顶部 返回列表