熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> JSP教程 >> 正文

JavaScript獲取FCK編輯器信息的具體方法

2013-11-15 12:07:21  來源: JSP教程 
這篇文章介紹了JavaScript獲取FCK編輯器信息的實例代碼有需要的朋友可以參考一下   復制代碼 代碼如下:

  
    function getEditorContents(){
    var oEditor = FCKeditorAPIGetInstance("content");
    alert(oEditorGetXHTML(true));
}
//向編輯器插入指定代碼
function insertHTMLToEditor(codeStr){
    var oEditor = FCKeditorAPIGetInstance("content");
    if (oEditorEditMode==FCK_EDITMODE_WYSIWYG){
     oEditorInsertHtml(codeStr);
    }else{
     return false;
    }
}
//統計編輯器中內容的字數
function getLength(){
    var oEditor = FCKeditorAPIGetInstance("content");
    var oDOM = oEditorEditorDocument;
    var iLength ;
    if(documentall){
     iLength = oDOMbodyinnerTextlength;
    }else{
     var r = oDOMcreateRange();
     rselectNodeContents(oDOMbody);
     iLength = rtoString()length;
    }
    alert(iLength);
}
//執行指定動作
function ExecuteCommand(commandName){
    var oEditor = FCKeditorAPIGetInstance("content") ;
    oEditorCommandsGetCommand(commandName)Execute() ;
}
//設置編輯器中內容
function SetContents(codeStr){
    var oEditor = FCKeditorAPIGetInstance("content") ;
    oEditorSetHTML(codeStr) ;
}


From:http://tw.wingwit.com/Article/program/Java/JSP/201311/20338.html
    推薦文章
    Copyright © 2005-2013 電腦知識網 Computer Knowledge   All rights reserved.