富文本,KindEditor的使用方法及(jsp)案例


在網上下載KindEditor源文件,

我用的是kindEditor4.1.2版本,加壓縮后目錄如下圖:

 

步驟1、將asp,asp.net,examples,php文件刪除,同時將jsp中的lib文件夾下的三個jar包拷貝到WEB-INF的lib下。

步驟2、新建一個editor文件夾,將剩余的文件放到該文件下面,同時將該文件放到項目文件下面。如項目名為phone則放在phone文件下。

步驟3、在需要富文本的jsp中加入一下代碼

          <script charset="utf-8" src="http://www.cnblogs.com/http://www.cnblogs.com/editor/kindeditor.js"></script>
     <script charset="utf-8" src="http://www.cnblogs.com/http://www.cnblogs.com/editor/lang/zh_CN.js"></script>
     <script>
           var editor;
           KindEditor.ready(function(K) {
                   editor = K.create('#editor_id');
           });
           var options = {
            cssPath : '/css/index.css',
            filterMode : true
        };
       var editor = K.create('textarea[name="content"]', options);
     </script>

步驟4、將頁面中需要富文本的textarea設置成如下形式

         <textarea id="editor_id" name="content" style="width:700px;height:300px;"></textarea> 

步驟5、后台就可以按着平常的獲取參數的方法獲取textarea的內容,該字段對應的mysql中的字段最好設置成text文本字段。

 


免責聲明!

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



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