ITeye博客

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

fancy205 · 2009-12-16 10:00 · js · Web前端 · Markdown

好吧,首先祝贺自己在javaeye安家。 :) 进入正题,由于工作的需要。就在网上找了些在线编辑器,诸如:eWebEditor,FCKeditor,CKeditor等。FCKeditor与CKeditor是一样的,只不过在3.0之后更改了名字,FCKeditor2.x的配置相对于3.x来说,比较麻烦。 1.FCKeditor配置使用 首先把fckeditor文件夹放到你的web站点根目录下,在你需要使用的页面导入FCKeditor 创建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以前的版本。

**2.ckeditor的配置使用**
相对FCKeditor来说,ckeditor 3.x的安装使用是简单了很多,只需一下简单的几步操作就ok了:
 a、下载最新的ckeditor <http://ckeditor.com/download>
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

评论(2)

  1. #2 楼 · fancy205 · 2010-01-12 10:52

    xiaoqing20 writes:

    原来是广州的兄弟啊!跟着你的帖子学着动手试试。

    呵呵

  2. #1 楼 · xiaoqing20 · 2010-01-10 12:55

    原来是广州的兄弟啊!跟着你的帖子学着动手试试。

评论功能维护中,当前仅展示历史评论。