使用fckeditor来进行网页在线文本编辑

1.把下载的fckeditor文件夹访如WebRoot文件夹中 文件夹结构目录:WebRoot----fckeditor/.....

  ----news/newsadd.jsp

2.在news文件夹新建newsadd.jsp

<html>
<head>
<title>My JSP</title>

<!-- 1,引入js文件 -->

<script type="text/javascript" src="../fckeditor/fckeditor.js"></script>

</head>


<!-- END HEAD -->
<body>

<form action="AddNews.action" method="post">
<table class="table table-striped table-hover table-bordered">

<tr class="">
<td>
标题:<input type="text" name="news.title" size="80"/>
</td>
<td>
<input type="submit" value="提交" />
</td>

</tr>
<tr>
<td>
内容:
</td>
</tr>
<tr>
<td>
<textarea style="" rows="80" cols="80" name="news.content"></textarea>
<!-- 2,在要显示的地方写一段js代码 -->
<script type="text/javascript">
var oFCKeditor = new FCKeditor('news.content') ; // 表单提交时传递的参数名
oFCKeditor.BasePath = "../fckeditor/" ; // 这个属性一定要设置,指定FCKeditor文件夹里所在的路径,一定要是以'/'结属。
oFCKeditor.Height = 300 ;
oFCKeditor.Width = 700 ;
oFCKeditor.ToolbarSet = "bbs"; // 使用指定的工具栏配置,默认为Default,我这里自定义了一个叫bbs的工具栏,去掉了几个功能
oFCKeditor.ReplaceTextarea(); // 替换指定name的textarea(隐藏textarea,显示FCKeditor)
</script>
</td>

</tr>

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

3.测试新闻添加成功



4.测试查看新闻成功



注意:省略了action的后台代码,并且自定义了工具栏(demo里有),图片上传功能也不能使用,只能放在线图片url。如果实现上传功能,得按照demo在服务器配置

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值