FCKEditor常用Js代碼,獲取FCK內(nèi)容,統(tǒng)計FCK字數(shù),向FCK寫入指定代碼
更新時間:2010年04月20日 18:18:40 作者:
FCKEditor常用Js代碼,獲取FCK內(nèi)容,統(tǒng)計FCK字數(shù),向FCK寫入指定代碼,使用FCKEditor的朋友可以參考下。增加編輯器的人性化功能。
content相當于你例子中的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)計編輯器中內(nèi)容的字數(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() ;
}
//設置編輯器中內(nèi)容
function SetContents(codeStr){
var oEditor = FCKeditorAPI.GetInstance("content") ;
oEditor.SetHTML(codeStr) ;
}
復制代碼 代碼如下:
//獲取格式化的編輯器內(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)計編輯器中內(nèi)容的字數(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() ;
}
//設置編輯器中內(nèi)容
function SetContents(codeStr){
var oEditor = FCKeditorAPI.GetInstance("content") ;
oEditor.SetHTML(codeStr) ;
}
您可能感興趣的文章:
- JS操作Fckeditor的一些常用方法(獲取、插入等)
- CKEditor無法驗證的解決方案(js驗證+jQuery Validate驗證)
- javascript獲取ckeditor編輯器的值(實現(xiàn)代碼)
- FCKeditorAPI 手冊 js操作獲取等
- fckeditor常用Js,獲取fckeditor內(nèi)容,統(tǒng)計fckeditor字數(shù),向fckeditor寫入指定代碼
- javascript fckeditor編輯器取值與賦值實現(xiàn)代碼
- FCKeditor提供了一個完整的JavaScript API
- JavaScript 使用Ckeditor+Ckfinder文件上傳案例詳解
相關文章
常用的HTML富文本編譯器UEditor、CKEditor、TinyMCE、HTMLArea、eWebEditor、Ki
這篇文章主要介紹了常用的HTML富文本編譯器UEditor、CKEditor、TinyMCE、HTMLArea、eWebEditor、KindEditor簡介,需要的朋友可以參考下2017-03-03autogrow 讓FCKeditor高度隨內(nèi)容增加的插件
讓FCKeditor高度隨內(nèi)容增加的插件,這個插件在默認情況下可能運行不正常,必須做一點修改才可以。2011-02-02FCKeditor 2.6.5 ASP環(huán)境安裝配置使用說明
今天用到在線編輯器在asp環(huán)境下上傳竟然無效。找了好久才找到這介紹,現(xiàn)備份于此,需要的朋友可以參考下2012-03-03javascript fckeditor編輯器取值與賦值實現(xiàn)代碼
這篇文章對于使用fckeditor編輯器的朋友是個不錯應用,主要介紹的是js對fckeditor的取值與賦值操作,fckeditor是個不錯的比較方便的擴展功能的編輯器。2010-05-05FCKeditor 2.6.6在ASP中的安裝及配置方法分享
FCKeditor目前的最新版本是2.6.6,在網(wǎng)上搜索此版本的配置方法,發(fā)現(xiàn)很少有asp的配置方法,以下就把自己的一些配置經(jīng)驗分享給有需要的你。2012-03-03百度編輯器從Json對象中取值,完成初次渲染,在編輯器內(nèi)畫表格
在百度編輯器中,如何完成從服務器取值,來渲染出表格?這里需要先console.log(editor);在官方API中已經(jīng)告訴我們寫入的方法是setContent(),這里只要能傳入我們最終拼好的的字符串,即可以在初始化中,繪制出我們想要的任何節(jié)點2012-06-06