日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

FCK 相关函数

發布時間:2025/3/15 编程问答 21 豆豆
生活随笔 收集整理的這篇文章主要介紹了 FCK 相关函数 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
獲取FCK的實例
FCKeditorAPI是FCKeditor加載后注冊的一個全局對象,利用它我們就可以完成對編輯器的各種操作。
在當前頁獲得 FCK 編輯器實例:
var Editor = FCKeditorAPI.GetInstance('InstanceName');
從 FCK 編輯器的彈出窗口中獲得 FCK 編輯器實例:
var Editor = window.parent.InnerDialogLoaded().FCK;
從 框架頁面的子框架中獲得其它子框架的 FCK 編輯器實例:
var Editor = window.FrameName.FCKeditorAPI.GetInstance('InstanceName');
從頁面彈出 窗口中獲得父窗口的 FCK 編輯器實例:
var Editor = opener.FCKeditorAPI.GetInstance('InstanceName');
FCK獲取焦點
獲 取焦點是否在FCK中:
oEditor.HasFocus
FCK獲取焦點:
oEditor.Focus();// 獲取焦點
獲取和設置FCK的內容
獲得 FCK 編輯器的內容:
oEditor.GetXHTML(formatted); // formatted 為:true|false,表示是否按HTML格式取出。
設置 FCK 編輯器的內容:
oEditor.SetHTML("content", false); // 第二個參數為:true|false,是否以所見即所得方式設置其內容。
插入內容到 FCK 編輯器:
oEditor.InsertHtml("html"); // "html"為HTML文本
檢查 FCK 編輯器內容是否發生變化:
oEditor.IsDirty();
1 // 獲取編輯器中HTML內容
2 function getEditorHTMLContents(EditorName) {
3 var oEditor = FCKeditorAPI.GetInstance(EditorName);
4 return(oEditor.GetXHTML(true));
5 }
6
7 // 獲取編輯器中文字內容
8 function getEditorTextContents(EditorName) {
9 var oEditor = FCKeditorAPI.GetInstance(EditorName);
10 return(oEditor.EditorDocument.body.innerText);
11 }
12
13 // 設置編輯器中內容
14 function SetEditorContents(EditorName, ContentStr) {
15 var oEditor = FCKeditorAPI.GetInstance(EditorName) ;
16 oEditor.SetHTML(ContentStr) ;
17 }
18

FCK的事件處理

FCK 定義有OnComplete,OnBlur和OnFocus等事件,這樣就可以使用事件的處理函數完成相應的處理。

FCK添加事件處理 函數的方法是:fckInstance.Events.AttachEvent( EventName, function)

代碼
//FCKeditor 加載完成后做處理的方法
function FCKeditor_OnComplete( editorInstance )
{
editorInstance.Events.AttachEvent( 'OnBlur' , FCKeditor_OnBlur ) ;
editorInstance.Events.AttachEvent( 'OnFocus', FCKeditor_OnFocus ) ;
}

function FCKeditor_OnBlur( editorInstance )
{
//失去焦點收起工具欄
editorInstance.ToolbarSet.Collapse() ;
}

function FCKeditor_OnFocus( editorInstance )
{

editorInstance.ToolbarSet.Expand() ;
}

轉載于:https://www.cnblogs.com/dengshunping/archive/2010/07/25/1784557.html

總結

以上是生活随笔為你收集整理的FCK 相关函数的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。