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());}

  • 相关阅读:
    Leetcode [654] 最大二叉树 &[105] 从前序与中序遍历序列构造二叉树 & [106] 从中序与后序遍历序列构造二叉树
    Leetcode [226] 翻转二叉树 & [116] 填充每个节点的下一个右侧节点指针 & [114] 二叉树展开为链表
    Leetcode 链表&二叉树刷题总结
    Leetcode 动态规划刷题总结
    Leetcode [1312] 让字符串成为回文串的最少插入次数 动态规划
    Leetcode [234] 回文链表 回文 链表
    动态规划之 KMP 算法详解(转)
    Leetcode [99] 恢复二叉搜索树 二叉树
    统计代码行数
    二叉树遍历(递归、非递归、mirror)转
  • 原文地址:https://www.cnblogs.com/yanran/p/5045396.html
Copyright © 2011-2022 走看看