//向编辑器插入指定代码
function insertHTMLToEditor(codeStr){
?var oEditor = FCKeditorAPI.GetInstance("content");
?oEditor.InsertHtml(codeStr); // "html"为HTML文本
}
//获取编辑器中HTML内容
function getEditorHTMLContents() {
?var oEditor = FCKeditorAPI.GetInstance("content");
?return(oEditor.GetXHTML(false));
}
// 获取编辑器中文字内容
function getEditorTextContents() {
?var oEditor = FCKeditorAPI.GetInstance("content");
?return(oEditor.EditorDocument.body.innerText);
}
// 设置编辑器中内容
function SetEditorContents(ContentStr) {
?var oEditor = FCKeditorAPI.GetInstance("content") ;
?oEditor.SetHTML(ContentStr) ;
}
//向编辑器插入指定代码
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()?? ;
}
详细解决方案
JS操作Fckeditor的一些惯用方法
热度:88 发布时间:2012-11-22 00:16:41.0
相关解决方案
- Tomcat启动错误 net.fckeditor.connector.ConnectorServlet
- fckeditor 下传图片时如何把路径传到数据库里;或者当image文件夹中添加一张图片时立即就往数据库中添加其名称
- 怎么使用FredCK.FCKeditor
- FCKeditor 控件图标不显示,该怎么处理
- 用fckeditor插件报错:"/fckeditor/fckstyles.xml" Do you want to see more info?”解决思路
- FCKeditor 下传不了图片
- fckeditor 配置上传音频文件 有关问题
- ckeditor ckeditor_aspnet fckeditor,该怎么解决
- 【加急】FCKeditor 2.6 怎么将编辑信息保存到SQLServer数据库?又怎么从数据库读取显示到页面
- 怎么给 Fckeditor 控件赋值的有关问题,不是取值!
- fckeditor 图片上传-生成文件夹【.net 2.0环境】解决方法
- FCKeditor html编辑器是免费的么,用于商业网站不会有版权的有关问题吧
- FCKeditor 不能显示自己上传的图片,多谢~
- FCKeditor 一个奇怪的图片显示有关问题
- FCKeditor 如何改变右键菜单的链接 清家当产求 急
- ASP.NET下使用[FCKeditor]有关问题,请高手帮忙
- fckeditor.net中如何用javascript操作
- 请问:FCKeditor.Net编辑器上传图片及Flash文件相关有关问题
- fckeditor 文件夹频繁丢掉
- fckeditor 文件夹频繁丢失,该如何解决
- ASP.NET分页代码的兑现(C#FCKeditor)
- FCKeditor 未结束的字符串 的有关问题
- FCKEditor 2.6.4 Asp.net上传文件没权限解决
- FCKEditor 2.6.4 Asp.net上传资料没有权限解决
- FCKEditor 2.6.4 Asp.net下传文件没有权限解决
- 深度求解,惯用的富文本框插件FreeTextBox、CKEditor、FCKEditor、uedtior、KindEditor ,到底哪个好用
- 关于 res://ieframe.dll/dnserror.htm#http://fckeditor/editor/fckeditor.html?I无法显示有关问题
- FCKeditor在线编辑器的运用(jsp:html在线编辑器=FCKeditor 2.2+FCKeditor.java 2.3 )
- FCKEditor 给下传图片加水印
- FCKeditor 配备