1. 程式人生 > >ckeditor 使用幾點

ckeditor 使用幾點

instance data 實例名 lang 使用 wid code nbsp 取值

1.引用相關js

2.定義 id 為 editor1 的 area

 <textarea id="editor1" style="height: 380px; width: 900px"></textarea>

3.替換

 <script type="text/javascript">   
      var editor = CKEDITOR.replace("editor1",
       {
              language: ‘vi‘, height: ‘370px‘, width: ‘900px‘
         });
 </script>

4. 賦值和取值

//取值對應實例名【editor1】的值,getData方法
var content=CKEDITOR.instances.editor1.getData();
//實例名【editor1】賦值為空
CKEDITOR.instances.editor1.setData(‘‘);

ckeditor 使用幾點