欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

FCKEditor常用Js代碼,獲取FCK內(nèi)容,統(tǒng)計(jì)FCK字?jǐn)?shù),向FCK寫入指定代碼

 更新時(shí)間:2010年04月20日 18:18:40   作者:  
FCKEditor常用Js代碼,獲取FCK內(nèi)容,統(tǒng)計(jì)FCK字?jǐn)?shù),向FCK寫入指定代碼,使用FCKEditor的朋友可以參考下。增加編輯器的人性化功能。
content相當(dāng)于你例子中的FCKeditor1。
復(fù)制代碼 代碼如下:

//獲取格式化的編輯器內(nèi)容
function getEditorContents(){
var oEditor = FCKeditorAPI.GetInstance("content");
alert(oEditor.GetXHTML(true));
}
//向編輯器插入指定代碼
function insertHTMLToEditor(codeStr){
var oEditor = FCKeditorAPI.GetInstance("content");
if (oEditor.EditMode==FCK_EDITMODE_WYSIWYG){
oEditor.InsertHtml(codeStr);
}else{
return false;
}
}
//統(tǒng)計(jì)編輯器中內(nèi)容的字?jǐn)?shù)
function getLength(){
var oEditor = FCKeditorAPI.GetInstance("content");
var oDOM = oEditor.EditorDocument;
var iLength ;
if(document.all){
iLength = oDOM.body.innerText.length;
}else{
var r = oDOM.createRange();
r.selectNodeContents(oDOM.body);
iLength = r.toString().length;
}
alert(iLength);
}
//執(zhí)行指定動(dòng)作
function ExecuteCommand(commandName){
var oEditor = FCKeditorAPI.GetInstance("content") ;
oEditor.Commands.GetCommand(commandName).Execute() ;
}
//設(shè)置編輯器中內(nèi)容
function SetContents(codeStr){
var oEditor = FCKeditorAPI.GetInstance("content") ;
oEditor.SetHTML(codeStr) ;
}

相關(guān)文章

最新評(píng)論