1. 程式人生 > >向頁面添加富文本編輯器

向頁面添加富文本編輯器

編輯器 上傳文件 .cn fck nbsp desc log dia esc

首先添加一個textarea:

1 <tbody id="tab_3" style="display: none">
2                 <tr>
3                     <td >
4                         <textarea rows="20" cols="180" id="productdesc" name="description"></textarea>
5                     </td>
6                 </
tr> 7 </tbody>

添加js代碼:

 1 if(ref == ‘#tab_3‘){
 2                 // 編輯器參數
 3                  var kingEditorParams = {
 4                     //指定上傳文件參數名稱
 5                     filePostName  : "uploadFile",
 6                     //指定上傳文件請求的url。
 7                     uploadJson : ‘/upload/uploadFck.do‘,
8 //上傳類型,分別為image、flash、media、file 9 dir : "image"//, 10 // width : ‘1000px‘, 11 // height : ‘400px‘ 12 }; 13 KindEditor.create(‘#productdesc‘,kingEditorParams); 14 KindEditor.sync();
15 }

庫的引用:

技術分享

向頁面添加富文本編輯器