fckeditor常用Js,獲取fckeditor內(nèi)容,統(tǒng)計fckeditor字數(shù),向fckeditor寫入指定代碼
更新時間:2010年08月08日 17:53:45 作者:
fckeditor常用Js,獲取fckeditor內(nèi)容,統(tǒng)計fckeditor字數(shù),向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() ;
}
//設(shè)置編輯器中內(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() ;
}
//設(shè)置編輯器中內(nèi)容
function SetContents(codeStr){
var oEditor = FCKeditorAPI.GetInstance(“content”) ;
oEditor.SetHTML(codeStr) ;
}
您可能感興趣的文章:
相關(guān)文章
關(guān)于CKeditor的非主流個性應用的設(shè)置
因為我的網(wǎng)站需要一個編輯器,所以用周末時間研究了一下CKeditor,終于最終修改成了合適的樣子。2009-12-12
CKEditor/FCKEditor 使用 CKeditor 3.0.1 快速使用教程(含插入圖片)
一般來說,我們在編輯內(nèi)容時,先是讀入到 textarea,再將 textarea 的內(nèi)容賦給編輯器。2010-03-03
fckeditor在php中的用法(添加于修改寫成了函數(shù))
這里就不多說了,看代碼。后面有說明。2009-12-12
CKEditor/FCKEditor 使用FCKeditor 2.6.5 快速使用教程(含插入圖片)
CKEditor 是著名的 HTML 編輯器,IBM、Oracle、Adobe 等都在用。CKEditor 創(chuàng)建于 2003 年,其前身為 FCKEditor,在 2009 年的時候把“F”去掉了,更名為 CKEditor。2010-03-03
百度ueditor組件上傳圖片后如何設(shè)置img里的alt屬性
百度ueditor組件,使用上傳圖片后,設(shè)置了一個alt屬性,其值是上傳圖片時的本地路徑,如果想更改的話可以參考下面的解決方法2014-09-09
FCKEditor常用Js代碼,獲取FCK內(nèi)容,統(tǒng)計FCK字數(shù),向FCK寫入指定代碼
FCKEditor常用Js代碼,獲取FCK內(nèi)容,統(tǒng)計FCK字數(shù),向FCK寫入指定代碼,使用FCKEditor的朋友可以參考下。增加編輯器的人性化功能。2010-04-04
SyntaxHighlighter配合CKEditor插件輕松打造代碼語法著色
作為程序員在寫博客文章的時候,經(jīng)常要些代碼片斷,很多博客系統(tǒng)都提供代碼語法著色高亮顯示的功能或插件,讓代碼顯示更直接明了2012-09-09

