zoukankan      html  css  js  c++  java
  • 编译器 的引用

    百度编译器(ueditor):

    <一>引入

    1:引入config js文件

    2:引入all_main js文件

    3:<textarea id="ediitor"></textarea>

    4:配置url路径window.UEDITOR_HOME_URL =》编译器路径

    5:实例化:var ue = UE.getEditor('editor');

    例:

    <div>
       <textarea id="goods"></textarea>
    </div>
    <!--<script  id="goods_desc" type="text/plain" style="500px;" >这里可以书写,编辑器的初始内容</script>-->
    <script type="text/javascript" src="../ueditor/utf8-php/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="../ueditor/utf8-php/ueditor.all.min.js"></script>
    <script type="text/javascript">
        //实例化编辑器
        //建议使用工厂方法getEditor创建和引用编辑器实例,如果在某个闭包下引用该编辑器,直接调用UE.getEditor('editor')就能拿到相关的实例
        window.UEDITOR_HOME_URL="../ueditor/";
        var ue = UE.getEditor('goods');

    </script>

    <二>参数的配置

    方法一:可以在config配置文件中直接修改

    方法二:可以在实例化的时候以参数的形式带入

    例如:   var ue = UE.getEditor('goods', {
        toolbars: [
            ['fullscreen', 'source', '|', 'undo', 'redo', '|',
                'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc', '|',
                'rowspacingtop', 'rowspacingbottom', 'lineheight', '|',
                'customstyle', 'paragraph', 'fontfamily', 'fontsize', '|',
                'directionalityltr', 'directionalityrtl', 'indent', '|',
                'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|', 'touppercase', 'tolowercase', '|',
                'link', 'unlink', 'anchor', '|']
        ],
        initialFrameWidth:500,
        initialFrameHeight:400,
    });

    <三>接收数据

    定义一个php文件

    <form action="02.php" method="post">
       <textarea id="goods" name="goods_desc"></textarea>
       <input type="submit" value="提交"/>
    </form>

    <四>如何在本页面获取编译器的内容

    正如以下所示:

    <title>无标题文档</title>
    <script type="text/javascript">
    function t(){
    var d =document.getElementsByTagName('textarea')[0];
    alert(d.innerHTML);
    }
    </script>
    </head>
    <body>
    <textarea >who you are</textarea>
    <input type="button" value="提交" onclick="t();"/>
    </body>

    <input type="button" value="ajax提交" onclick="t2();"/>

    此时获取数据的方法

    function t2(){

    alert(ue.getContent());}

  • 相关阅读:
    有关Python,网络,机器学习,深度学习
    Python map使用
    左旋转字符串,翻转字符串
    使用Python创建二叉树,作为调试程序使用
    batchnorm2d函数理解,numpy数据归一化
    和为s的连续正数序列,和为s的两个数字
    判断是否为平衡二叉树
    原生js格式化json的方法
    ace editor 使用教程
    Vue+webpack+echarts+jQuery=demo
  • 原文地址:https://www.cnblogs.com/yanran/p/5045396.html
Copyright © 2011-2022 走看看