迎国庆:js获取和设置FCK编辑器的内容

来源:百度文库 编辑:九乡新闻网 时间:2024/04/29 19:54:39
// 获取编辑器中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) ; 
}