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

FCKeditorAPI 手冊(cè) js操作獲取等

 更新時(shí)間:2011年01月27日 14:03:25   作者:  
FCKeditorAPI 手冊(cè) js操作控制,獲取等函數(shù)代碼,使用網(wǎng)頁(yè)編輯器的朋友可以參考下。
復(fù)制代碼 代碼如下:

function abc()
{
var checkContent =FCKeditorAPI.GetInstance("editor");//獲取實(shí)例
alert(checkContent.GetXHTML());//獲取當(dāng)前內(nèi)容
var newelement = document.createElement("a");
newelement.href="#";
newelement.innerHTML="df";
checkContent.InsertElement(newelement);//前部添加元素(無(wú)返回值)
var a=checkContent.InsertElementAndGetIt(newelement);//前部添加元素(返回元素)
checkContent.InsertHtml("")//添加html
checkContent.SetHTML("",true);//設(shè)置內(nèi)容,后為bool,是否所見(jiàn)即所得

}
function aaa()
{
var checkContent =FCKeditorAPI.GetInstance("editor");//獲取實(shí)例
checkContent.SwitchEditMode();//轉(zhuǎn)變編輯模式
checkContent.UpdateLinkedField();//更新關(guān)聯(lián)文件
}
function FCKeditor_OnComplete( checkContent )//當(dāng)加載完
{
alert( checkContent.Name ) ;
}

//設(shè)置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)計(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) ;
}

//使用FCKEditor時(shí)使用js在光標(biāo)處添加任意字符串
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() ;
}

相關(guān)文章

最新評(píng)論