HTML编辑器FCKeditor使用详解(2)

作者:FastUnit 来源:Java快速开发平台 时间:2010-02-28 12:30:00 

四、使用

本例使用最直接的js方式,API和TagLib方式参见FCKeditor-2.3.zip解压后_samples下的例子。

fckdemo.jsp: 


<%@    page contentType="text/html;charset=GBK"%>
<html>
<head>
<title>FCKeditor Test</title>
<script type="text/javascript" src="/fckeditor/fckeditor.js"></script>
</head>
<body>
<form action="fckdemo.jsp" method="post">

<% 
String content=request.getParameter("content");
if (content != null) {
  content = content.replaceAll("\r\n", "");
  content = content.replaceAll("\r", "");
  content = content.replaceAll("\n", "");
  content = content.replaceAll("\"", "'");
}else{
  content = "";
}
%>

<table width=100%>
<tr>
    <td colspan=4 style='text-align:center' width=100% height=50px>
    <span>
        <script type="text/javascript">
            var oFCKeditor = new FCKeditor('content');//传入参数为表单元素(由FCKeditor生成的input或textarea)的name
            oFCKeditor.BasePath='/fckeditor/';//指定FCKeditor根路径,也就是fckeditor.js所在的路径
            oFCKeditor.Height='100%';
            oFCKeditor.ToolbarSet='Demo';//指定工具栏
            oFCKeditor.Value="<%=content%>";//默认值
            oFCKeditor.Create();
        </script>
    </span>
    </td>
</tr>
<tr><td align=center><input type="submit" value="提交"></td></tr>
<tr><td>&nbsp;</td></tr>
<tr><td>取值(可直接保存至数据库):</td></tr>
<tr><td style="padding:10px;"><%=content%></td></tr>
</table>

</form>
</body>
</html> 

效果图:

标签:FCKeditor,编辑器,html编辑器
0
投稿

猜你喜欢

  • MySQL5创建存储过程实例

    2010-06-13 12:49:00
  • 图片滤镜效果[IE Only]

    2009-06-14 19:49:00
  • 网站设计配色方案教程

    2007-10-10 19:38:00
  • eWebEditor不支持IE8的解决方法

    2009-11-02 10:59:00
  • 一个拖动层和Onmouse自动下拉效果

    2007-10-08 21:25:00
  • 瞬间的设计(四)【碳酸饮料会】

    2009-12-23 13:56:00
  • getAllResponseHeaders获取网页的http头信息代码

    2010-03-31 14:31:00
  • Asp中如何快速分页的技巧

    2008-05-17 12:02:00
  • 为导入文件加上时间戳标记的两种方法

    2009-01-07 14:14:00
  • HTML与CSS在Flash中的应用

    2008-01-23 19:13:00
  • SQL提高查询效率之Like篇

    2011-10-01 09:36:42
  • Oracle DBA常用语句第1/2页

    2009-08-08 22:38:00
  • Javascript优化(文件瘦身)

    2008-06-02 13:20:00
  • SQL SERVER查询所有数据库名,表名,和字段名的语句

    2012-01-05 19:25:26
  • 运行SQL Server的计算机间移动数据库

    2009-01-20 13:07:00
  • 利用mergeAttributes设置name属性

    2009-12-12 18:48:00
  • 在查询分析器理启动或停止SQL Agent服务

    2009-01-08 16:20:00
  • 在Oracle中向视图中插入数据的方法

    2009-02-28 10:42:00
  • ASP:Cookie使用指南

    2007-09-28 12:48:00
  • asp正则表达式详细说明

    2008-10-23 16:23:00
  • asp之家 网络编程 m.aspxhome.com