//紫色部分是加载kindeditor.js文件的路径,红色部分要和页面上textarea标签的name值一样
<load href="__PUBLIC__/Js/kindeditor-4.1.5/kindeditor.js" />
<script>
var editor;KindEditor.ready(function(K) {
//编辑器
editor = K.create('textarea[name="content_html"]', {
allowFileManager : true
});
//上传图片
K('#images').click(function() {
editor.loadPlugin('image', function() {
editor.plugin.imageDialog({
imageUrl : K('#imgs').val(),
clickFn : function(url, title, width, height, border, align) {
K('#imgs').val(url);
editor.hideDialog();
}
});
});
});
//上传文件
K('#files').click(function() {
editor.loadPlugin('insertfile', function() {
editor.plugin.fileDialog({
fileUrl : K('#filepath').val(),
clickFn : function(url, title) {
K('#filepath').val(url);
editor.hideDialog();
}
});
});
});
});
//此功能editor.sync();是用来获取textarea的值的,如果没有这条命令在本页面JS就获取不到富文本编辑器的值
function getcontent(){
editor.sync();
}
</script>
<table>
<tr>
<td align="right" >文章内容:</td>
<td><textarea id="content_html" name="content_html" cols="100" rows="30">{$rs.content_html}</textarea></td>
</tr>
<tr>
<td align="right"> </td>
<td><input name="button" type="submit" class="button" id="button" value="确定编辑" onClick="getcontent()"/>
<input name="button" type="button" class="button" id="button" value="取 消" οnclick="javascript:history.go(-1)" /></td>
</tr>
</table>