富文本编辑器

//紫色部分是加载kindeditor.js文件的路径,红色部分要和页面上textarea标签的name值一样

<load href="__PUBLIC__/Js/kindeditor-4.1.5/kindeditor.js" />

<script>

var editor;
KindEditor.ready(function(K) {
    //编辑器
    editor = K.create('textarea[name="content_html"]', {
        allowFileManager : true
    });
    
    //上传图片
    K('#images').click(function() {
        editor.loadPlugin('image', function() {
            editor.plugin.imageDialog({
                imageUrl : K('#imgs').val(),
                clickFn : function(url, title, width, height, border, align) {
                    K('#imgs').val(url);
                    editor.hideDialog();
                }
            });
        });
    });
    
    //上传文件
    K('#files').click(function() {
        editor.loadPlugin('insertfile', function() {
            editor.plugin.fileDialog({
                fileUrl : K('#filepath').val(),
                clickFn : function(url, title) {
                    K('#filepath').val(url);
                    editor.hideDialog();
                }
            });
        });
    });
});

//此功能editor.sync();是用来获取textarea的值的,如果没有这条命令在本页面JS就获取不到富文本编辑器的值
function getcontent(){
editor.sync();
}

</script>


<table>

<tr>

          <td align="right" >文章内容:</td>
          <td><textarea id="content_html" name="content_html" cols="100" rows="30">{$rs.content_html}</textarea></td>
      </tr>
      <tr>
        <td align="right">&nbsp;</td>
        <td><input name="button" type="submit" class="button" id="button" value="确定编辑" onClick="getcontent()"/>
          &nbsp;&nbsp;
        <input name="button" type="button" class="button" id="button" value="取 消" οnclick="javascript:history.go(-1)" /></td>
      </tr>

</table>

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值