zoukankan      html  css  js  c++  java
  • ueditor 设置高度height. ue.setHeight(400); 设置宽度 width

    1.引入的文件:

    1 <script type="text/javascript" src="../../dist/ueditor1_4_3-utf8-php/ueditor.config.js"></script>
    2     <script type="text/javascript" src="../../dist/ueditor1_4_3-utf8-php/ueditor.all.js"></script>

    2. html.

     1 <textarea id="container" class="content"></textarea> 

    1 .content {
    2             width: 660px;
    3             /*height: 500px;*/
    4             margin-left: 20px;
    5             margin-right: 20px;
    6             border: 1px solid red;
    7         }

    3.设置宽度width.

      可以直接 通过css设置 textarea的宽度就可以了.

    4.设置高度 height:

      4-1: 通过 设置textarea的高度: 错误. height:400px;

        

    1 .content {
    2             width: 660px;
    3             height: 400px;
    4             margin-left: 20px;
    5             margin-right: 20px;
    6             border: 1px solid red;
    7         }

       4-2: 通过ueditor的方法设置:

        

     1 <script type="text/javascript">
     2 
     3      var ue = UE.getEditor('container');
     4 
     5      ue.ready(function() {
     6           ue.setHeight(400);
     7          //设置编辑器的内容
     8          // ue.setContent('hello');
     9          // //获取html内容,返回: <p>hello</p>
    10          // var html = ue.getContent();
    11          // //获取纯文本内容,返回: hello
    12          // var txt = ue.getContentTxt();
    13      });
    14 
    15 </script>

    注意的是: 这里 要在 ue.ready() 中设置 ,表示当ue准备好了的时候.

     设置的高度是 编辑区域的高度, 不包括 上面 和 下面.

  • 相关阅读:
    javascript 编码规范
    javascript 减少全部变量
    轮播图 jquery
    SVN MAC
    php excel
    php email
    查看网站后台
    linux 下载文件
    第6周小组作业:软件测试和评估
    第4周小组作业:WordCount优化
  • 原文地址:https://www.cnblogs.com/cbza/p/7056597.html
Copyright © 2011-2022 走看看