获取FCKeditor编辑器内容的值 30 March 2010 13:50 Tuesday by 小屋 浏览(2648)

答案原址:http://www.phpchina.com/html/97/n-33197.html
利用Javascript取和设FCKeditor值也是非常容易的,如下:

EditorName是页面中可编辑区域元素的id比如:
<TEXTAREA id="texterea1" name="content" rows="30" cols="420"><c:out value="${content}"/></TEXTAREA>
EditorName就是texterea1了

// 获取编辑器中HTML内容
function getEditorHTMLContents(EditorName) {
var oEditor = FCKeditorAPI.GetInstance(EditorName);
return(oEditor.GetXHTML(true));
}

// 获取编辑器中文字内容
function getEditorTextContents(EditorName) {
var oEditor = FCKeditorAPI.GetInstance(EditorName);
return(oEditor.EditorDocument.b

阅读全文>>

使用JS获取FCKEditor中的内容 30 November 2009 22:41 Monday by小屋 浏览(2010)

  1. // 获取FCKEditor中的内容: content为Editor实例的ID
  2. function getEditorContents(){
  3.    var oEditor = FCKeditorAPI.GetInstance("content");
  4.    alert(oEditor.GetXHTML(true));
  5. }
  6.  
  7. // 向编辑器插入指定代码
  8. function insertHTMLToEditor(codeStr){
  9.    var oEditor = FCKeditorAPI.GetInstance("content");
  10.    if (oEditor.EditMode==FCK_EDITMODE_WYSIWYG){
  11.    oEditor.InsertHtml(codeStr);
  12.    }else{
  13.    return false;
  14.    }
  15. }
  16.  
  17. // 统计编辑器中内容的字数

阅读全文>>