fck编辑器:JavaScript 获取 FCK 编辑器的信息

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) ;
}
本文链接http://www.cxybl.com/html/wyzz/JavaScript_Ajax/20121203/34634.html

时间: 2024-08-25 18:28:58

fck编辑器:JavaScript 获取 FCK 编辑器的信息的相关文章

JavaScript获取FCK编辑器信息的具体方法

这篇文章介绍了JavaScript获取FCK编辑器信息的实例代码,有需要的朋友可以参考一下   复制代码 代码如下:     function getEditorContents(){     var oEditor = FCKeditorAPI.GetInstance("content");     alert(oEditor.GetXHTML(true)); } //向编辑器插入指定代码 function insertHTMLToEditor(codeStr){     var o

Javascript 获取滚动条位置等信息的函数_javascript技巧

其实这段代码在之前的 " 用 Javascript 实现锚点(Anchor)间平滑跳转" 一文已经介绍过了,但是由于这个需求并且经常用到,因此,本站专门发布此文介绍,方便查阅. 复制代码 代码如下: <script type="text/javascript"> // 说明:用 Javascript 获取滚动条位置等信息 // 来源 :ThickBox 2.1 function getScroll() { var t, l, w, h; if (docu

设置fck焦点及获取fck编辑器内容 长度 js代码

本教程主要讲了怎么利用js 来设置编辑器获得焦点获取fck编辑器内容判断是否为空,以及内容长度与js调用fck编辑器的方法. var checkcontent =fckeditorapi.getinstance("content").getxhtml(); 写成函数 function geteditorhtmlcontents(editorname) { var oeditor = fckeditorapi.getinstance(editorname); return(oeditor

javascript获取ckeditor编辑器的值(实现代码)_javascript技巧

CKeditor编辑器是FCKeditor的升级版本想对于FCK来说,确实比较好用,加载速度也比较快以下是如果通过JS获取CKeditor编辑器的值,用于表单验证 if(CKEDITOR.instances.content.getData()==""){alert("内容不能为空!");return false;} content是textarea的name下次发下CKeditor的配置还有上传配置,我只弄了PHP的上传 刚有个朋友反应说FIREFOX下不能判断为空

JavaScript获取FCK编辑器信息的具体方法_javascript技巧

复制代码 代码如下:     function getEditorContents(){     var oEditor = FCKeditorAPI.GetInstance("content");     alert(oEditor.GetXHTML(true)); } //向编辑器插入指定代码 function insertHTMLToEditor(codeStr){     var oEditor = FCKeditorAPI.GetInstance("content&

JavaScript获取各大浏览器信息图示_基础知识

如何获取浏览器信息 Window有navigator对象让我们得知浏览器的全部信息.我们可以利用一系列的API函数得知浏览器的信息. JavaScript代码如下: 复制代码 代码如下: function message(){ txt = "<p>浏览器代码名: " + navigator.appCodeName + "</p>"; txt+= "<p>浏览器名称: " + navigator.appName

Javascript 获取滚动条位置

   代码如下 复制代码 <script type="text/javascript">   // 说明:用 Javascript 获取滚动条位置等信息 // 来源 :ThickBox 2.1 // 整理 : ( http://www.111cn.net )   function getScroll() {     var t, l, w, h;       if (document.documentElement && document.documentE

javascript 获取FCKeditor内容_网页编辑器

形式如: 复制代码 代码如下: varoEditor=FCKeditorAPI.GetInstance('content'); varcontent=oEditor.GetXHTML(true); ************************************************* 利用Javascript取和设FCKeditor值也是非常容易的,如下: 复制代码 代码如下: // 获取编辑器中HTML内容 function getEditorHTMLContents(Editor

如何在在线编辑器里集成公式编辑器,有资料说fck可以集成webeq,但是找不到WebEQApplet.jar,有没有人有啊,或者其他更好的方式

问题描述 如何在在线编辑器里集成公式编辑器,有资料说fck可以集成webeq,但是找不到WebEQApplet.jar,有没有人有啊,或者其他更好的方式 解决方案 解决方案二:该回复于2011-03-24 13:50:45被版主删除解决方案三:我也想要啊!!!!!