在线编辑器 ckeditor3.x的配置使用

好吧,首先祝贺自己在javaeye安家。 :)
进入正题,由于工作的需要。就在网上找了些在线编辑器,诸如:eWebEditor,FCKeditor,CKeditor等。FCKeditor与CKeditor是一样的,只不过在3.0之后更改了名字,FCKeditor2.x的配置相对于3.x来说,比较麻烦。
[size=medium][b]1.FCKeditor配置使用[/b][/size]
首先把fckeditor文件夹放到你的web站点根目录下,在你需要使用的页面导入FCKeditor
<script type="text/javascript" src="fckeditor/fckeditor.js"></script>
创建FCKeditor通常有几种方法:
第一种:嵌入式引用
在你需要的地方增加一下代码段
<script type="text/javascript">
var oFCKeditor = new FCKeditor("FCKeditor1");
oFCKeditor.BasePath = "/reg/fckeditor/";
oFCKeditor.Create();

</script>

例如
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>inline </TITLE>

<script type="text/javascript" src="fckeditor/fckeditor.js"></script>

</HEAD>

<BODY>
<form>
<script type="text/javascript">
var oFCKeditor = new FCKeditor("FCKeditor1");
oFCKeditor.BasePath = "/reg/fckeditor/";
oFCKeditor.Create();

</script>

</form>
</BODY>
</HTML>

第二种:替换textarea
<script type="text/javascript">
window.onload = function(){
var oFCKeditor = new FCKeditor("exarea");
oFCKeditor.BasePath = "/reg/fckeditor/";
oFCKeditor.ReplaceTextarea();
}
</script>
<textarea id="exarea" name="exarea"></textarea>


上面是对FCKeditor配置使用的介绍,即是ckeditor3.0以前的版本。

[size=medium][b]2.ckeditor的配置使用[/b][/size]
相对FCKeditor来说,ckeditor 3.x的安装使用是简单了很多,只需一下简单的几步操作就ok了:
a、下载最新的ckeditor [url]http://ckeditor.com/download[/url]
b、抽取出editor文件夹放到你所属站点的根目录
c、在需要使用编辑器的地方引入
<script type="text/javascript" src="ckeditor/ckeditor.js"></script>

加入一下代码就可以了
 <textarea class="ckeditor" cols="80" id="editor" name="editor" rows="10">
这里是内容
</textarea>

c、部署好后,还可以查看ckeditor自带的例子
http://你的站点地址<CKEditor installation path>/_samples/index.html
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值