1.引入這些文件:javascript
2.html中先寫入模板:html
<textarea name="contentremark" id="contentremark"></textarea>
3.js:java
初始化:編輯器
var ue = UE.getEditor('contentremark',{toolbar:[["insertunorderedlist","insertorderedlist","bold","italic"]]});
設置和讀取編輯器的內容:工具
var ue = UE.getContent(); //對編輯器的操做最好在編輯器ready以後再作 ue.ready(function() { //設置編輯器的內容 ue.setContent('hello'); //獲取html內容,返回: <p>hello</p> var html = ue.getContent(); //獲取純文本內容,返回: hello var txt = ue.getContentTxt(); });
4.工具欄的值(如下是與字體相關的):字體
insertunorderedlist/insertorderedlist 無序列表/有序列表code
bold/italic/underline/strikethrough 加粗/斜體/下劃線/中間行線htm
forecolor/backcolor 字體顏色/背景顏色blog
justifyleft/justifyright/justifycenter/justifyjustify 居左/右/中對齊 兩端對齊ip
fontfamily/fontsize/customstyle/paragraph 字體/字體大小/自定義標題/段落格式