FCKeditorAPI 手冊 js操作獲取等
更新時間:2011年01月27日 14:03:25 作者:
FCKeditorAPI 手冊 js操作控制,獲取等函數(shù)代碼,使用網(wǎng)頁編輯器的朋友可以參考下。
復制代碼 代碼如下:
function abc()
{
var checkContent =FCKeditorAPI.GetInstance("editor");//獲取實例
alert(checkContent.GetXHTML());//獲取當前內(nèi)容
var newelement = document.createElement("a");
newelement.href="#";
newelement.innerHTML="df";
checkContent.InsertElement(newelement);//前部添加元素(無返回值)
var a=checkContent.InsertElementAndGetIt(newelement);//前部添加元素(返回元素)
checkContent.InsertHtml("")//添加html
checkContent.SetHTML("",true);//設置內(nèi)容,后為bool,是否所見即所得
}
function aaa()
{
var checkContent =FCKeditorAPI.GetInstance("editor");//獲取實例
checkContent.SwitchEditMode();//轉變編輯模式
checkContent.UpdateLinkedField();//更新關聯(lián)文件
}
function FCKeditor_OnComplete( checkContent )//當加載完
{
alert( checkContent.Name ) ;
}
//設置fckeditor為只讀
function FCKeditor_OnComplete(editorInstance)
{
editorInstance.EditorDocument.body.disabled = true;
editorInstance.EditorWindow.parent.document.getElementById ('xExpanded').style.display = 'none';
editorInstance.EditorWindow.parent.document.getElementById('xCollapsed').style.display = 'none';
editorInstance.EditorWindow.blur();
}
//向編輯器插入指定代碼
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) ;
}
//使用FCKEditor時使用js在光標處添加任意字符串
function InsertHTML(e,inStr)//e:FCKEditor的ID,inStr:要插入的信息
{
var oEditor = FCKeditorAPI.GetInstance(e) ;
if ( oEditor.EditMode == FCK_EDITMODE_WYSIWYG )
{
oEditor.InsertHtml( inStr ) ;
}
else
alert("You must be on WYSIWYG mode!" ) ;
}
function ExecuteCommand( commandName,e )
{
var oEditor = FCKeditorAPI.GetInstance(e) ;
oEditor.Commands.GetCommand(commandName ).Execute() ;
}
您可能感興趣的文章:
- JS操作Fckeditor的一些常用方法(獲取、插入等)
- CKEditor無法驗證的解決方案(js驗證+jQuery Validate驗證)
- javascript獲取ckeditor編輯器的值(實現(xiàn)代碼)
- fckeditor常用Js,獲取fckeditor內(nèi)容,統(tǒng)計fckeditor字數(shù),向fckeditor寫入指定代碼
- javascript fckeditor編輯器取值與賦值實現(xiàn)代碼
- FCKEditor常用Js代碼,獲取FCK內(nèi)容,統(tǒng)計FCK字數(shù),向FCK寫入指定代碼
- FCKeditor提供了一個完整的JavaScript API
- JavaScript 使用Ckeditor+Ckfinder文件上傳案例詳解
相關文章
ckeditor syntaxhighlighter代碼高亮插件配置分享
現(xiàn)在大家可以不必像我這樣為了實現(xiàn)代碼高亮的功能,去修改ckeditor編輯器,大家可以去使用百度編輯器(Ueditor)他有代碼高亮的功能,還蠻好用的,我的個人網(wǎng)站就是的百度編輯器的。歡迎大家去我的博客看看2014-12-12針對PHP環(huán)境下Fckeditor編輯器上傳圖片配置詳細教程
今天介紹Fckeditor上傳圖片功能在PHP中的配置方法,涉及Fckeditor上傳圖片的上傳路徑配置、限制Fckeditor上傳圖片大小設置、Fckeditor上傳圖片文件名重名及亂碼解決方法以及針對上傳圖片添加水印功能的實現(xiàn)方法,只要掌握了以上四點,F(xiàn)ckeditor在大部分PHP類型網(wǎng)站中的應用都能解決2014-04-04使用ZeroClipboard解決跨瀏覽器復制到剪貼板的問題
Zero Clipboard 利用透明的Flash讓其漂浮在復制按鈕之上,這樣其實點擊的不是按鈕而是 Flash ,這樣將需要的內(nèi)容傳入Flash,再通過Flash的復制功能把傳入的內(nèi)容復制到剪貼板2014-06-06當使用ckeditor控件時,需要校驗輸入內(nèi)容是否為空的一種解決辦法(轉帖)
這樣是我們寫程序中最經(jīng)常的寫法 提交之前進行驗證內(nèi)容是否為空!2011-01-01FCKeditor2.3 For PHP 詳細整理的使用參考
FCKeditor2.3 For PHP 詳細整理的使用參考...2007-11-11