CKEditor是一个专门使用在网页上属于 开放源代码 的所见即所得文字 编辑器 。以前叫FCKEditor。

1、到官网下载CKEditor:http://ckeditor.com/download  ,解压后复制到工程的WEBROOT目录下。

2、新建JSP页面,引用其JS文件<script type="text/javascript" src="ckeditor/ckeditor.js"></script>

3、用CKEditor替代textarea:

<textarearows="30"cols="50"name="editor01">请输入.</textarea>

4、用CKEditor替代textarea,有两种方法,相应的javascript代码如下:

在textarea后面加入javascript:

<scripttype="text/javascript">CKEDITOR.replace('editor01');</script>

在加载后调用响应的方法:

<scripttype="text/javascript">window.onload=function()
    {
        CKEDITOR.replace(
'editor01');
    };
</script>

配置完成,效果如下图:

该编辑器是默认配置,显示了所有工具栏,可使只显示需要的工具栏;编辑框的背景颜色等也可以调整。替代textarea的javascript如下:

function window.onload() {    //页面加载完成后执行以下表达式CKEDITOR.replace( 'noticeContent',{uiColor : '#ccccff',toolbar :[ { name: 'document', items : ['Save','DocProps','Preview','Print'] },{ name: 'clipboard', items : [ 'Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo' ] }, { name: 'editing', items : [ 'Find','Replace','-','SelectAll','-','SpellChecker', 'Scayt' ] }, { name: 'basicstyles', items : ['Bold','Italic','Underline','Strike','Subscript','Superscript','-','RemoveFormat' ] },{ name: 'paragraph', items : [ 'NumberedList','BulletedList','-','Outdent','Indent','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','BidiLtr','BidiRtl'] },{ name: 'links', items : [ 'Link','Unlink','Anchor' ] }, { name: 'insert', items: ['Table','HorizontalRule','SpecialChar','PageBreak' ]}, { name: 'styles', items : [ 'Styles','Format','Font','FontSize' ] }, { name:'colors', items : [ 'TextColor','BGColor' ] },{ name: 'tools', items : [ 'Maximize' ] } ]});    }

修改后,效果如下:

其中toolbar的完整内容如下,工具按钮是分组的,一个name内的大括号就是一个工具按钮分组,items后边是具体的按钮,我们可以对这些内容进行适当的删除:

function window.onload() {    //页面加载完成后执行以下表达式CKEDITOR.replace( 'noticeContent',{toolbar :[ { name: 'document', items : ['Source','-','Save','NewPage','DocProps','Preview','Print','-','Templates' ] }, { name: 'clipboard', items : [ 'Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo' ] }, { name: 'editing', items : [ 'Find','Replace','-','SelectAll','-','SpellChecker', 'Scayt' ] }, { name: 'forms', items : [ 'Form', 'Checkbox', 'Radio','TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField' ] }, '/', { name: 'basicstyles', items : ['Bold','Italic','Underline','Strike','Subscript','Superscript','-','RemoveFormat' ] },{ name: 'paragraph', items : [ 'NumberedList','BulletedList','-','Outdent','Indent','-','Blockquote','CreateDiv', '-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','BidiLtr','BidiRtl'] }, { name: 'links', items : [ 'Link','Unlink','Anchor' ] }, { name: 'insert', items: ['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak','Iframe' ]}, '/', { name: 'styles', items : [ 'Styles','Format','Font','FontSize' ] }, { name:'colors', items : [ 'TextColor','BGColor' ] }, { name: 'tools', items : [ 'Maximize','ShowBlocks','-','About' ] } ]});}

CKEditor的基本使用就是这样了。

使用CKEditor编辑的信息可能会很大,当大于4000时,oracle的varchar2类型无法再满足,可以使用clob类型,使用方法详见:oracle中clob类型的使用

CKEditor的使用示例相关推荐

  1. Ckeditor+Ckfinder+Ext4 整合

    @author:杨虹昌 原文地址:http://blog.csdn.net/yanghongchang_/article/details/12778695 时间:2013年10月15日 CSDN讨论组 ...

  2. oracle中clob类型的使用

    oracle数据库当需要存入大数据量(大于4000)时,varchar2不够用,可以使用clob,本文描述clob怎么和Hibernate一起使用. 以公告Notice的公告内容noticeConte ...

  3. CKEditor快速介绍与入门示例

    CKEditor 富文本编辑器 CKEditor 是一款知名的WYSIWYG富文本Web编辑器,WYSIWYG 的全称是what you see is what you get,也就是所见即所得. 富 ...

  4. ckeditor上传图片示例

    1.修改config.js CKEDITOR.editorConfig = function (config) {// Define changes to default configuration ...

  5. CKeditor 配置使用

    CKeditor 配置使用 一.使用方法: 1.在页面<head>中引入ckeditor核心文件ckeditor.js <script type="text/javascr ...

  6. CKEditor+CKFinder配置学习

    CKEditor+CKFinder配置学习 基于dotNetFramework环境, 解决方案部署在VS2010 + dotNetFramework4.0 [下载源码] 富文本编辑器学习,常见富文本编 ...

  7. phpeditor编写php_在php中使用CKEDITOR在线编辑器

    一.官方Download 1.CKEditor:点击CKEditor.NET标题下的"Download zip"按钮 下载的文件:ckeditor_aspnet_3.6.2.zip ...

  8. 富文本编辑器ckeditor的使用

    Ckeditor下载地址:http://ckeditor.com/download 一.使用方法: 1.在页面<head>中引入ckeditor核心文件ckeditor.js <sc ...

  9. ckeditor 4.2.1_演示 ckeditor 上传插入图片

    本文内容 FineUI ckeditor fckeditor/ckeditor 演示 ckeditor 4.2.1 上传&插入图片 最近看了一下 FineUI_v3.3.1 控件,对里边的 c ...

最新文章

  1. DPOS机制会比POW机制表现更好吗?
  2. Redis相比memcached
  3. 集体奔赴农业战场 互联网巨头对话中国农民丰收节交易会
  4. Python编程:制作电子相册
  5. python 简单网页_Python爬虫 (一):爬取一个简单的静态网页
  6. node.js知识点总结
  7. java调用oracle 存储过程 以及游标使用
  8. vijos1237-隐形的翅膀【离散化】
  9. fatal: Could not read from remote repository.的解决办法
  10. 也谈WEB打印(四):让我们的模板支持打印,并根据内容动态的生成页面
  11. LeetCode算法题-Design LinkedList(Java实现)
  12. 周志华《机器学习》-所有公式推导集合
  13. Kali学习 | 密码攻击:6.10 创建密码字典
  14. Linux内核学习篇三:中断处理 -- asm.s和traps.c
  15. leetcode解题思路分析(一百二十八)1053 - 1078 题
  16. 向量法计算空间点到线段的距离(python)
  17. 苹果再次要求供应商降价,将伤及自身
  18. 用html语言制作表白动画,抖音很火的卡通做我女朋友表白html源码
  19. iOS 一个APP打开另一个APP
  20. Spring实战笔记——(1)Spring之旅(上)

热门文章

  1. Java打印异常的正确方式
  2. ESD保护芯片BAT54S/BAV99和电平转换芯片SN74AVC1T45
  3. 从零开始学python的第16天
  4. html固定页脚布局及样式,html页脚固定在底部的方法
  5. COS、OBS、OSS对比
  6. 简易新闻系统,功能包含用户登录、新闻发布删除、评论管理等
  7. 远程视频监控:流媒体之FFmpeg+RTMP+Nginx+VLC
  8. 视频营销(Video Marketing)1-视频营销基础
  9. 一个月一个微信小程序(个人开发)---“助你考公“(一周年纪念礼物)
  10. bzoj4476: [Jsoi2015]送礼物