您现在的位置是:网站首页> 编程资料编程资料
fckeditor常用Js,获取fckeditor内容,统计fckeditor字数,向fckeditor写入指定代码_网页编辑器_
2023-05-25
292人已围观
简介 fckeditor常用Js,获取fckeditor内容,统计fckeditor字数,向fckeditor写入指定代码_网页编辑器_
content相当于你例子中的FCKeditor1。
//获取格式化的编辑器内容
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) ;
}
复制代码 代码如下:
//获取格式化的编辑器内容
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) ;
}
您可能感兴趣的文章:
相关内容
- FCKEDITOR 相关函数介绍_网页编辑器_
- FCKEditor+jQuery+PHP实现分页代码_网页编辑器_
- 一款支持插入表情的编辑器实现代码(简单思路挺重要)_网页编辑器_
- 页面嵌入Windows Media Player播放器代码需要注意的_网页编辑器_
- CKeditor与syntaxhighlight打造joomla代码高亮_网页编辑器_
- FCKEditor超级链接默认新窗口打开的修改方法_网页编辑器_
- Office文档在线编辑的一个实现方法_网页编辑器_
- FCKeditor添加自定义按钮的方法_网页编辑器_
- 22个国外的Web在线编辑器收集_网页编辑器_
- Js FCKeditor的值获取和修改的代码小结_网页编辑器_
