fckeditor的两种基本配置

1.Fckeditor官网:http://ckeditor.com/
2.下载地址: http://ckeditor.com/download
3.文档地址: http://docs.cksource.com

一.将下载后的文件解压并放到WebRoot目录下
二.导入JS文件
<script type="text/javascript" src="fckeditor/fckeditor.js"></script>
三.使用,有四种方法来调用
1.使用JS直接创建

Js代码
1.<script type="text/javascript">
2.var oFCKeditor = new FCKeditor('FCKeditor1');
3.//1.BasePath表示fckeditor的目录
4.//第一个/表示WEBServer的根目录,所以必须加上工程路径
5.//最后必须以/结尾,否则报错
6.//2.可以使用相对路径如: fckeditor/
7.oFCKeditor.BasePath = "fckeditor/";
//网站上有很多是"/fckeditor/",在我这个会报错,去掉前面的"/"就可以了
8.oFCKeditor.Width = "100%";
9.oFCKeditor.Height = 400;
10.//默认属性 Width 100%
11.// Height 200
12.// Value ""
13.// ToolbarSet "Default"(Basic或自己定制)
14.// BasePath /fckeditor/
15.oFCKeditor.Create();
16.</script>
<script type="text/javascript">
var oFCKeditor = new FCKeditor('FCKeditor1');
//1.BasePath表示fckeditor的目录
//第一个/表示WEBServer的根目录,所以必须加上工程路径
//最后必须以/结尾,否则报错
//2.可以使用相对路径如: fckeditor/
oFCKeditor.BasePath = "/fckeditor/";
oFCKeditor.Width = "100%";
oFCKeditor.Height = 400;
//默认属性 Width 100%
// Height 200
// Value ""
// ToolbarSet "Default"(Basic或自己定制)
// BasePath /fckeditor/
oFCKeditor.Create();
</script>



2.使用JS替换已有的TextArea

Js代码
1.<script type="text/javascript">
2.window.onload = function()
3.{
4.var oFCKeditor = new FCKeditor( 'MyTextarea' ) ;
5.oFCKeditor.BasePath = "fckeditor/" ;
6.oFCKeditor.ReplaceTextarea() ;
7.}
8.</script>
<textarea id="MyTextarea" name="MyTextarea">This is <b>the</b> initial value.</textarea>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值