`
周禄康
  • 浏览: 157930 次
  • 性别: Icon_minigender_1
  • 来自: 石家庄
社区版块
存档分类
最新评论

javascript获取FCKeditor内容

阅读更多

利用Javascript取和设FCKeditor值也是非常容易的,如下:

// 获取编辑器中HTML内容
function getEditorHTMLContents(EditorName) {
    var oEditor = FCKeditorAPI.GetInstance(EditorName);
    return(oEditor.GetXHTML(true));
}

// 获取编辑器中文字内容
function getEditorTextContents(EditorName) {
    var oEditor = FCKeditorAPI.GetInstance(EditorName);
    return(oEditor.EditorDocument.body.innerText);
}

// 设置编辑器中内容
function SetEditorContents(EditorName, ContentStr) {
    var oEditor = FCKeditorAPI.GetInstance(EditorName) ;
    oEditor.SetHTML(ContentStr) ;
}

FCKeditorAPI是FCKeditor加载后注册的一个全局对象,利用它我们就可以完成对编辑器的各种操作。

在当前页获得 FCK 编辑器实例:
var Editor = FCKeditorAPI.GetInstance('InstanceName');

从 FCK 编辑器的弹出窗口中获得 FCK 编辑器实例:
var Editor = window.parent.InnerDialogLoaded().FCK;

从框架页面的子框架中获得其它子框架的 FCK 编辑器实例:
var Editor = window.FrameName.FCKeditorAPI.GetInstance('InstanceName');

从页面弹出窗口中获得父窗口的 FCK 编辑器实例:
var Editor = opener.FCKeditorAPI.GetInstance('InstanceName');

获得 FCK 编辑器的内容:
oEditor.GetXHTML(formatted); // formatted 为:true|false,表示是否按HTML格式取出
也可用:
oEditor.GetXHTML();

设置 FCK 编辑器的内容:
oEditor.SetHTML("content", false); // 第二个参数为:true|false,是否以所见即所得方式设置其内容。此方法常用于"设置初始值"或"表单重置"哦作。

插入内容到 FCK 编辑器:
oEditor.InsertHtml("html"); // "html"为HTML文本

检查 FCK 编辑器内容是否发生变化:
oEditor.IsDirty();

在 FCK 编辑器之外调用 FCK 编辑器工具条命令:
命令列表如下:
DocProps, Templates, Link, Unlink, Anchor, BulletedList, NumberedList, About, Find, Replace, Image, Flash, SpecialChar, Smiley, Table, TableProp, TableCellProp, UniversalKey, Style, FontName, FontSize, FontFormat, Source, Preview, Save, NewPage, PageBreak, TextColor, BGColor, PasteText, PasteWord, TableInsertRow, TableDeleteRows, TableInsertColumn, TableDeleteColumns, TableInsertCell, TableDeleteCells, TableMergeCells, TableSplitCell, TableDelete, Form, Checkbox, Radio, TextField, Textarea, HiddenField, Button, Select, ImageButton, SpellCheck, FitWindow, Undo, Redo

使用方法如下:
oEditor.Commands.GetCommand('FitWindow').Execute();

= FCKConfig.BasePath + 'plugins/' 
// FCKConfig.Plugins.Add( 'placeholder', 'en,it' ) ;

分享到:
评论

相关推荐

    javascript获取FCKeditor内容.txt

    javascript获取FCKeditor内容.txt

    javascript获取FCKeditor内容.pdf

    javascript获取FCKeditor内容.pdf

    javascript获取FCKeditor内容[文].pdf

    javascript获取FCKeditor内容[文].pdf

    javascript 获取FCKeditor内容

    javascript获取FCKeditor内容,需要的朋友可以参考下。

    FCKeditor获取选中内容的JS

    FCKeditor获取选中内容的JS,内有本人亲自写的注释,还有获取整个编辑框的HTML内容 也就是源代码的JS,下载超值,,

    request_and_set_FCKeditor_value.rar_fckeditor val_javascript

    利用JavaScript获取与设置FCKeditor编辑器的值。

    JS操作Fckeditor的一些常用方法(获取、插入等)

    javascript获取和设置FCKeditor内容 利用Javascript取和设FCKeditor值也是非常容易的,如下: // 获取编辑器中HTML内容 function getEditorHTMLContents(EditorName) { var oEditor = FCKeditorAPI.GetInstance...

    利用Javascript取和设FCKeditor值(转)

    NULL 博文链接:https://zyzhongyang.iteye.com/blog/839996

    Fckeditor2.6.3

    FCKeditor2.6zip是其最新的Javascript文件和图片等; FCKeditor.NET.zip是一个ASP.NET控件DLL文件。 下面结合一个ASP.NET2.0的项目来具体看看FCKeditor的安装、配置、使用。在开始之前请先下载FCKeditor文件包和...

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

    CKeditor编辑器是FCKeditor的升级版本想对于FCK来说,确实比较好用,加载速度也比较快以下是如果通过JS获取CKeditor编辑器的值,用于表单验证 if(CKEDITOR.instances.content.getData()==””){alert(“内容不能...

    FCKPro(aspx)

    具体的文档可以参考我的博客“FCKeditor使用说明”,在这个demo中,主要实现的是通过JavaScript调用FCKeditorAPI,获取并设置编辑器的值,同时在aspx环境中上传文件。

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

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

    ASP.NET基础控件-教程

    内容:  Asp.net页面内传参数方法  调用存储过程(两种方法比较)  调用存储过程通用类DBHelper  加密解密  SQL常用DBHelper  Asp.net存储过程无限分类  TreeView无限分类  无限分类MVC  荧光棒效果获取控件...

    Blog程序开源:X2Blog

    X2Blog的目标是提供一个具有... 本系统使用了两个出色的开源项目如下: 基于web的html编辑器asp.net控件,地址是:http://www.fckeditor.net/ 浏览器端Javascript的一个开发框架prototype:http://prototype.conio.net/

    asp.net开发常用整理集合

     javascript小技巧  DotNet 密码加密的技术  用户MD5加密  ASP.net验证码实现  图片水印  防盗链  .NET(C#)连接各类数据库  读取配置文件数据库连接串  正则表达式验证  递归把十进制转换八进制...

    Java Web应用详解.张丽(带详细书签).pdf

    6.5 FCKeditor 框架应用 第7章 JDBC数据库连接 7.1 JDBC 概述 7.2 JDBC的工作原理 7.3 数据库的安装与使用 7.4 JDBC 编程 7.5 网络留言板V1.0 第8章数据库连接池技术 8.1 数据库连接池 8.2 网络留言板V2.0 ...

    php资料库4 防止foeach中变量不是数组

    如何对MySQL 服务器进行调优(页 1) - 数据库-数据仓库 - ZDNetChina中文社区 资讯硬件软件开发技术论坛.mht 如何对MySQL服务器进行调优-Linux认证考试-考试大.mht ...javascript获取label控件的值来源.txt

    php课程(共100多节)

    31:PHP在线编辑器fckeditor应用 32:PHP5中Cookie与 Session详解 33:PHP5中图片验证码的制作(上) 34:PHP5中图片中文验证码(下) 35:PHP5文字图片混合水印与缩略图 36:PHP中正则表达式学习及应用(一) 37:...

Global site tag (gtag.js) - Google Analytics