zoukankan      html  css  js  c++  java
  • 富文本编辑器

    1、wangEditor

    例子:

      

    <div id="div1">
    <p>欢迎使用 <b>wangEditor</b> 富文本编辑器</p>
    </div>
    <textarea id="text1" style="100%; height:200px;"></textarea>//可以隐藏textarea( display:none;)

    <script src="jquery.min.js"></script>
    <script type="text/javascript" src="wangEditor.min.js"></script>
    <script type="text/javascript">
    var E = window.wangEditor
    var editor = new E('#div1')
    var $text1 = $('#text1')
    editor.customConfig.onchange = function (html) {
    // 监控变化,同步更新到 textarea
    $text1.val(html)
    }
    editor.create()
    // 初始化 textarea 的值
    $text1.val(editor.txt.html())
    </script>

    2、CKEditor (比较好用)

    例子:

    (1) 将ckeditor整个文件夹放到网站资源目录下

    (2) 在要添加ckeditor的页面中引入ckeditor核心文件ckeditor.js

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

    (3) 将相应的控件替换成编辑器代码,即:在textarea下方编写:js:CKEDITOR.replace('textarea的name')

    <td> <textarea id="opinion" name="opinion" rows="10" cols="38">${item.opinion}</textarea></td>

    <script type="text/javascript">

    var opt =document.getElementById("opinion");

    CKEDITOR.replace(opt)

    </script> 

  • 相关阅读:
    ORBSLAM2的资源
    工程思想
    Linux中PATH、 LIBRARY_PATH、 LD_LIBRARY_PATH和ROS_PACKAGE_PATH
    CMkeList文件编写
    SLAM资料
    windows下隐藏文件夹
    Ubuntu16装Flash
    知识管理
    学习纲领
    lsof详解
  • 原文地址:https://www.cnblogs.com/uftwkb24/p/9242386.html
Copyright © 2011-2022 走看看