6、jQuery插件之kindEditor富本编辑器与UEditor编辑器

kindEditor富本编辑器
默认版本:
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <script src="kindeditor-4.1.7/kindeditor.js"></script>
        <style>
            #tid{
                height: 100px;
                width: 1000px;
            }
        </style>
    </head>
    <body>
    <form action="">
        <p>用户名:</p>
        <p><input type="text" /></p>
        <p>密码:</p>
        <p><input type="text" /></p>
        <p>留言:</p>
        <p>
            <textarea id="tid" cols="30" rows="10"></textarea>
        </p>
    </form>
    <script>
        KindEditor.ready(function(K) {
            editor = K.create('#tid');
        });
    </script>
    </body>

</html>

效果:


版本二:(含有配置项)
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <script src="kindeditor-4.1.7/kindeditor.js"></script>
        <style>
            #tid{
                height: 100px;
                width: 660px;
            }
        </style>
    </head>
    <body>
    <form action="">
        <p>用户名:</p>
        <p><input type="text" /></p>
        <p>密码:</p>
        <p><input type="text" /></p>
        <p>留言:</p>
        <p>
            <textarea id="tid" cols="30" rows="10"></textarea>
        </p>
    </form>
    <script>
        KindEditor.ready(function(K) {
            editor = K.create('#tid', {
                resizeType : 1 ,//不允许左右调大小
                allowPreviewEmoticons : false, //不允许qq表情预览
                allowImageUpload : false ,  //不允许图片上传
                items : [ //定制导航项,可以配置项的内容可以去kindeditor.js获的
        'source', '|', 'undo', 'redo', '|', 'preview', 'print', 'template', 'code', 'cut', 'copy', 'paste',
        'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',
        'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
        'superscript', 'clearhtml', 'quickformat', 'selectall', '|', 'fullscreen', '/',
        'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
        'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'image', 'multiimage',
        'flash', 'media', 'insertfile', 'table', 'hr', 'emoticons', 'baidumap', 'pagebreak',
        'anchor', 'link', 'unlink', '|', 'about'
    ]
            });
        });
    </script>
    </body>
</html>

UEditor编辑器
版本一
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../../../css/mes.css">
<title>编辑留言</title>
</head>
<script type="text/javascript" charset="utf-8" src="../../../ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="../../../ueditor/ueditor.all.js"></script>
<body οnlοad=startclock()>
<form name="clock">
<script src="../../../js/time.js"></script>
<div align="right">
<input name="thetime"
     style="font-size: 16pt;color:#000000;border:1px solid #FFFFFF; background:#05FFC9; " size="24">
</div>
</form>
<h1 align="center">编辑留言</h1>
<div align="center">
<form action="<?php echo site_url('user/edit_message')."/".$mes['mes_id'];?>"
    method=" post" name="myform" onSubmit="return uptext();">
<table>
         <tr>
             <td><font size="+2">标题:</font></td>
            <td><input type="text" size="55" name="title"/></td>
        </tr>
        <tr>
             <td><font size="+2">内容:</font></td>
            <td><input name="info" type="hidden" id="info">
<script type="text/plain" id="editor" name="editor" style="width: 400px; height: 200px;"></script></td>
        </tr>
          <tr>
             <td colspan="2" align="center">
            <input type="submit" class="sub" name="submit" value="发布留言"></td>
        </tr>
        <tr>
             <td colspan="2" align="center">
            <h3><a href="<?php echo site_url('user/message_view')?>">返回</a></td></h3>
        </tr> 
     </form></div>
<div ></div>
</body>
<script type="text/javascript">
     var ue=UE.getEditor('editor');
     </script>
<script type="text/javascript" language="javascript">
  //这段要放在文本编辑器的实例化之后
  function uptext(){
       if(myform.title.value.length<3){
          alert("标题不能少于3个字符!");
          myform.title.focus();
          return false;
     }
    if (!UE.getEditor('editor').hasContents()){
          alert('请先填写内容!');
          return false;
    }else{
    document.myform.info.value=UE.getEditor('editor').getContent();
    document.myform.submit();

    }
  }
</script>
</html>
后台接收:
$body=$_POST["info"];

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值