天下第二博

Tian Xia The Second BO
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

FCKEditor的赋值和取值操作

Posted on 2009-05-24 02:52  Nuke'Blog  阅读(253)  评论(0)    收藏  举报
1、获取编辑器中HTML内容
function getEditorHTMLContents(EditorName)

    
var oEditor = FCKeditorAPI.GetInstance(EditorName); 
    
return(oEditor.GetXHTML(true)); 
}

2、获取编辑器中文字内容(在博客发布时获取无html代码摘要使用)
function getEditorTextContents(EditorName)

    
var oEditor = FCKeditorAPI.GetInstance(EditorName); 
    
return(oEditor.EditorDocument.body.innerText); 
}

3、设置编辑器中内容
function SetEditorContents(EditorName, ContentStr)

    
var oEditor = FCKeditorAPI.GetInstance(EditorName) ; 
    oEditor.SetHTML(ContentStr) ; 
}