fckeditorは頻繁にJsを使用して、fckeditorの内容を取得して、fckeditorの字数を統計して、fckeditorに指定コードを書き込みます.
1290 ワード
contentはあなたの例のFC Keditor 1に相当します.
//
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;
}
}
//
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);
}
//
function ExecuteCommand(commandName){
var oEditor = FCKeditorAPI.GetInstance(“content”) ;
oEditor.Commands.GetCommand(commandName).Execute() ;
}
//
function SetContents(codeStr){
var oEditor = FCKeditorAPI.GetInstance(“content”) ;
oEditor.SetHTML(codeStr) ;
}