`
luxhua
  • 浏览: 86203 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

整合FCKEditor到项目中

阅读更多
以JavaScript方式整合

1.到http://www.fckeditor.net/download下载FCKeditor 2.6.4.1的zip压缩包
2.将解压后的fckeditor文件夹整个复制到你的web项目的WebRoot根目录下
3.验证是否安装成功:在IE地址栏输入:
http://<your site>/<FCKeditor installation path>/_samples/default.html进行验证
如:http://localhost/你的项目名/fckeditor/_samples/default.html
出现fckeditor的编辑页面说明安装成功

4.引入到你的jsp页面中
4.1 在你的jsp页面中加入
  
 <script type="text/javascript" src="fckeditor/fckeditor.js"></script>

4.2在<head></head>标签之间加入
<script type="text/javascript">
window.onload = function()
{
var oFCKeditor = new FCKeditor( [color=red]'MyTextarea'[/color] ) ;
oFCKeditor.BasePath = "/fckeditor/" ;
oFCKeditor.ReplaceTextarea() ;
}
</script>


注:这是在你的jsp页面中有了一个testArea,你希望在这个testArea中用fckeditor来显示。
   MyTextarea 要和你的testArea的id一致
   "/fckeditor/"改为"/你的项目名/fckeditor/"
5.ok,fckeditor已经整合到项目中了,当然了,你还以配置显示的样式,工具栏,根据自己需要
参照官方文档就ok了
oFCKeditor.ToolbarSet = '' //设置工具栏
oFCKeditor.Height=  //设置高度
......

还可以在fckeditor.js中的FCKConfig.FontSizes配置中文字体,注意修改后一定要保存问UTF-8编码
否则中文名称会显示乱码。
   
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics