1、将xheditor加入到项目中
2、引入xheditor编辑器的js库
<script src="../../editor/xheditor/xheditor-1.1.14-zh-cn.min.js" type="text/javascript"></script>
3、html页面(将xheditor加载在textarea上)
<div class="tab-content">
<textarea id="editor" name="editor" rows="20" cols="100" ></textarea>
</div>
4、js中初始化xheditor
//初始化编辑器
var Sys = {};
if(navigator.userAgent.indexOf("MSIE")>0) {
Sys.ie=true;
}else{
Sys.ie=false;
}
var editor = $('#editor').xheditor
({tools:'Blocktag,Fontface,FontSize,Bold,Italic,Underline,Strikethrough,FontColor,BackColor,SelectAll,Removeformat,|,Align,List,Outdent,Indent,|,Link,Unlink,
Img,Hr,Table,|,Fullscreen',skin:'default', upImgUrl:"../../mvc/upload/xhEditorUpload.json?_t=image&isIE="+Sys.ie,upImgExt:"jpg,jpeg,gif,png,bmp"});
5、常用到编辑器的函数
editor.appendHTML(“内容”); //给编辑器赋内容
$('#editor').xheditor().getSource();//获取编辑器的值