富文本框Ueditor的简单使用

1.下载百度富文本框代码asp版本加入程序。

找到asp-Upload下的config.json,修改各类文件保存地址,文件大小等

2.在页面中使用Ueditor

 1 <script>
 2     var ue;
 3     $(function () {
 4         ue = UE.getEditor(‘UeF_Content‘,{
 5             toolbars: [[
 6                 ‘fullscreen‘,‘source‘,‘|‘,‘undo‘,‘redo‘,‘|‘, 7                 ‘bold‘,‘italic‘,‘underline‘,‘fontborder‘,‘strikethrough‘,‘superscript‘,‘subscript‘,‘removeformat‘,‘formatmatch‘,‘autotypeset‘,‘blockquote‘,‘pasteplain‘,‘forecolor‘,‘backcolor‘,‘insertorderedlist‘,‘insertunorderedlist‘,‘selectall‘,‘cleardoc‘, 8                 ‘rowspacingtop‘,‘rowspacingbottom‘,‘lineheight‘, 9                 ‘customstyle‘,‘paragraph‘,‘fontfamily‘,‘fontsize‘,10                 ‘directionalityltr‘,‘directionalityrtl‘,‘indent‘,11                 ‘justifyleft‘,‘justifycenter‘,‘justifyright‘,‘justifyjustify‘,‘touppercase‘,‘tolowercase‘,12                 ‘link‘,‘unlink‘,‘anchor‘,‘imagenone‘,‘imageleft‘,‘imageright‘,‘imagecenter‘,13                 ‘simpleupload‘,‘insertimage‘,‘emotion‘,‘scrawl‘,/*‘insertvideo‘,*/ ‘music‘,‘attachment‘,‘map‘,‘gmap‘,/*‘insertframe‘,‘insertcode‘,*/ /*‘webapp‘,*/ ‘pagebreak‘,‘template‘,‘background‘,14                 ‘horizontal‘,‘date‘,‘time‘,‘spechars‘,/*‘snapscreen‘,*/ ‘wordimage‘,15                 ‘inserttable‘,‘deletetable‘,‘insertparagraphbeforetable‘,‘insertrow‘,‘deleterow‘,‘insertcol‘,‘deletecol‘,‘mergecells‘,‘mergeright‘,‘mergedown‘,‘splittocells‘,‘splittorows‘,‘splittocols‘,‘charts‘,16                 ‘print‘,‘preview‘,‘searchreplace‘/*,‘drafts‘,‘help‘*/
17             ]],18               //根据需要增删需要的文本框功能,这里我去掉了一些功能,也可以直接在ueditor.config.js中修改后调用,这些功能样式等可以在ueditor.all.js中查看,修改
19             scaleEnabled: true,20             initialFrameHeight: 500,//设置文本框高度
21             initialFrameWidth: ‘100%‘,//设置文本框宽度
22             elementPathEnabled: true,23             catchRemoteImageEnable: true
24         });
25 
26     });
27     var keyValue = $.request("keyValue");
28     $(function () {
29 
30         if (!!keyValue) {
31             $.ajax({                                //用ajax接收后台传的值
32                 url: "/SystemManage/Companies/GetFormJson",33                 data: { keyValue: keyValue },34                 dataType: "json",35                 async: false,36                 success: function (data) {
37                     $("#form").formSerialize(data);
38 
39                     $(".UeF_Content").val(data.F_Content);   //读取数据库存储内容
40                 }
41             });
42         }
43 
44     });
45 
46 
47     function submitForm() {
48         if (!$(‘#form‘).formValid()) {
49             return false;
50         }
51 
52         $("#F_Content").val(ue.getContent());  //提交文本框中内容
53 
54         $.submitForm({
55             url: "/SystemManage/AllianceCompanies/SubmitForm?keyValue=" + keyValue,56             param: $("#form").formSerialize(),57             success: function () {
58                 $.currentWindow().$("#gridList").resetSelection();
60                 $.currentWindow().$("#gridList").trigger("reloadGrid");
61 
62             }
63         })
64     }
65 </script>
1        form表单中的内容:
<tr> 2 <th class="formTitle" valign="top" style="padding-top: 5px;"> 3 内容 4 </th> 5 <td class="formValue" colspan="3" style="padding: 0px;"> 6 <input type="hidden" id="F_Content" /> //数据库中字段 7 <textarea class="UeF_Content" id="UeF_Content" name="UeF_Content"></textarea> 8 </td> 9 </tr>

中间还更改过一些其他内容,时间久了,忘记改了哪些了,关于Ueditor的使用也可以找官方文档参考一下。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


kindeditor4.x代码高亮功能默认使用的是prettify插件,prettify是Google提供的一款源代码语法高亮着色器,它提供一种简单的形式来着色HTML页面上的程序代码,实现方式如下: 首先在编辑器里面插入javascript代码: 确定后会在编辑器插入这样的代码: <pre
这一篇我将介绍如何让kindeditor4.x整合SyntaxHighlighter代码高亮,因为SyntaxHighlighter的应用非常广泛,所以将kindeditor默认的prettify替换为SyntaxHighlighter代码高亮插件 上一篇“让kindeditor显示高亮代码”中已经
js如何实现弹出form提交表单?(图文+视频)
js怎么获取复选框选中的值
js如何实现倒计时跳转页面
如何用js控制图片放大缩小
JS怎么获取当前时间戳
JS如何判断对象是否为数组
JS怎么获取图片当前宽高
JS对象如何转为json格式字符串
JS怎么获取图片原始宽高
怎么在click事件中调用多个js函数
js如何往数组中添加新元素
js如何拆分字符串
JS怎么对数组内元素进行求和
JS如何判断屏幕大小
js怎么解析json数据
js如何实时获取浏览器窗口大小
原生JS实现别踩白块小游戏(五)
原生JS实现别踩白块小游戏(一)