以Javascript方式整合FCKEditor到项目中

    技术2022-05-20  31

    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>标签之间加入

     1.<script type="text/javascript"><!-- 2.window.onload = function() 3.{ 4.var oFCKeditor = new FCKeditor( [color=red]'MyTextarea'[/color] ) ; 5.oFCKeditor.BasePath = "/fckeditor/" ; 6.oFCKeditor.ReplaceTextarea() ; 7.} 8. // --></script>

    注:这是在你的jsp页面中有了一个testArea,你希望在这个testArea中用fckeditor来显示。    MyTextarea 要和你的testArea的id一致    "/fckeditor/"改为"/你的项目名/fckeditor/" 5. ok,fckeditor已经整合到项目中了,当然了,你还以配置显示的样式,工具栏,根据自己需要 参照官方文档就ok了 oFCKeditor.ToolbarSet = '' //设置工具栏 oFCKeditor.Height=  //设置高度 ...... 还可以在fckeditor.js中的FCKConfig.FontSizes配置中文字体,注意修改后一定要保存问UTF-8编码 否则中文名称会显示乱码。

     


    最新回复(0)