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准備好了的時候.

 

 

 設置的高度是 編輯區域的高度, 不包括 上面 和 下面.

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM