JavaScript代码
- 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) ;
- }
Yhustc说道:
- function InsertHTML(html) {
- var oEditor = FCKeditorAPI.GetInstance("editor") ;
- if (oEditor.EditMode == FCK_EDITMODE_WYSIWYG ) {
- oEditor.InsertHtml(html) ;
- }else
- alert( "FCK必须处于WYSIWYG模式!" ) ;
- }