fckeditor常用Js,獲取fckeditor內(nèi)容,統(tǒng)計(jì)fckeditor字?jǐn)?shù),向fckeditor寫入指定代碼
更新時間:2010年08月08日 17:53:45 作者:
fckeditor常用Js,獲取fckeditor內(nèi)容,統(tǒng)計(jì)fckeditor字?jǐn)?shù),向fckeditor寫入指定代碼
content相當(dāng)于你例子中的FCKeditor1。
//獲取格式化的編輯器內(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í)行指定動作
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) ;
}
復(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í)行指定動作
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) ;
}
您可能感興趣的文章:
- JS操作Fckeditor的一些常用方法(獲取、插入等)
- CKEditor無法驗(yàn)證的解決方案(js驗(yàn)證+jQuery Validate驗(yàn)證)
- javascript獲取ckeditor編輯器的值(實(shí)現(xiàn)代碼)
- FCKeditorAPI 手冊 js操作獲取等
- javascript fckeditor編輯器取值與賦值實(shí)現(xiàn)代碼
- FCKEditor常用Js代碼,獲取FCK內(nèi)容,統(tǒng)計(jì)FCK字?jǐn)?shù),向FCK寫入指定代碼
- FCKeditor提供了一個完整的JavaScript API
- JavaScript 使用Ckeditor+Ckfinder文件上傳案例詳解
相關(guān)文章
fckeditor常用Js,獲取fckeditor內(nèi)容,統(tǒng)計(jì)fckeditor字?jǐn)?shù),向fckeditor寫入指定代碼
fckeditor常用Js,獲取fckeditor內(nèi)容,統(tǒng)計(jì)fckeditor字?jǐn)?shù),向fckeditor寫入指定代碼2010-08-08FCKeditor smarty 編輯器的應(yīng)用PHP
自己仔細(xì)研究一下很容易解決你這個問題的。這并不是一個很困難的任務(wù)。其實(shí)這里很多都是菜鳥級別的2012-07-07Ueditor和CKeditor 兩款編輯器的使用與配置方法
這篇文章主要介紹了Ueditor和CKeditor 兩款編輯器的使用與配置方法,需要的朋友可以參考下2017-03-03頁面嵌入Windows Media Player播放器代碼需要注意的
在頁面中插入WMP確實(shí)是個令人頭疼的一件事。這里簡單的說明下,希望對需要朋友有所幫助。2010-07-07