1,头部引用

<link href="ueditor/themes/default/css/ueditor.css" rel="stylesheet" type="text/css" />

   <script src="ueditor/ueditor.config.js" type="text/javascript"></script>

  <script src="ueditor/ueditor.all.js" type="text/javascript"></script>

2,页面设个textarea和一个input hidden(隐藏域保存txtarea的数据,用于获取C#服务端获取)

<textarea id="txtTContent" tip="内容" ></textarea>

<input id="hidTContent" name="hidTContent" type="hidden" />

3,书写脚本

<script type="text/javascript">

function GetTextValue() {

try {

var count = $("#txtTTopic").val().length;

if (count == 0) {

alert('标题不能为空');

return false;

}

var oTxt = editor.getContent();

if (oTxt.length <= 0) {

alert('内容不能为空');

return false;

}

$("#hidTContent").val(htmlEncode(oTxt));

return true;

}

catch (err) {

alert(err);

return false;

}

}

function htmlEncode(value) {

if (value) {

return jQuery('<div />').text(value).html();

} else {

return '';

}

}

</script>

<script language="javascript" type="text/javascript">    // UEditor

var option = {

initialContent: '', //初始化编辑器的内容

initialFrameWidth: 602,

initialFrameHeight: 312, //设置高度

textarea: 'editorValue' //设置提交时编辑器内容的名字,之前我们用的名字是默认的editorValue

};

var editor = new baidu.editor.ui.Editor(option); //将设置初始化(之前的配置采用的是默认的,所以没有传参数)

editor.render("txtTContent");

</script>

4,后台获取

string str = Server.HtmlDecode(Request.Form["hidTContent"]);

5,其它特性

BBS回复引用

<a href="javascript:scroll(0,5000)" onclick="Reply('<%# Container.ItemIndex + CurPageItemIndex +1 %>','<%#Eval("Col_ReplyUser")%>','<%# FilterHtml.CutStrBySeparate(Eval("RContent").ToString(), 80)%>')">回复</a>

<script type="text/javascript">

function Reply(layer, user, content) {

//editor.setContent('');

var html = '<h4 style="font-size:12px; font-weight:normal; width:758px; line-height:22px; padding: 0 5px; color:#aaa; border:1px solid #ccc; overflow:hidden;">&nbsp;&nbsp;引用 ';

html += user + '(' + layer + '楼)&nbsp;&nbsp;';

html += content;

html += '<h4></h4><h4></h4>';

html += '<br/>';

editor.setContent(html,false);

editor.focus();

}

</script>

ueditor文本编辑器的使用的更多相关文章

  1. Ueditor文本编辑器(新浪SAE平台版本) - 下载频道 - CSDN.NET

    Ueditor文本编辑器(新浪SAE平台版本) - 下载频道 - CSDN.NET Ueditor文本编辑器(新浪SAE平台版本)

  2. UEditor文本编辑器

    Ueditor是由百度web前端研发部开发所见即所得的编辑器,具有轻量,可定制,注重用户体验等特点.Ueditor基于BSD开源协议,除了具有代码精简.加载迅速的轻量级特质 外,还采用了分层理念,使开 ...

  3. ASP.MVC 项目中使用 UEditor 文本编辑器

    1.下载UEditor 源文件,并导入项目中 2.添加项目中需要使用的CSS和JS //Ueditor 文本编辑器必备的StyleBundle和ScriptBundle StyleBundle ued ...

  4. JForum论坛添加UEditor文本编辑器

    在使用JForum论坛中发现论坛自带的文本编辑器不好用,不能上传图片,样式编辑也很麻烦,就想着把这个文本编辑器替换掉,我这里选用的是百度的开源富文本编辑器UEditor 替换后的效果图 替换方法如下 ...

  5. 个人纪录(初)----Ueditor文本编辑器的引用

    源码下载地址:http://ueditor.baidu.com/website/ 打开源码参考.html 把ueditor引入自己的web项目下. 在需要引入文本的地方写个div,设置样式等. 并且在 ...

  6. ueditor 文本编辑器

    百度编辑器       压缩包在文件里 百度UEditor编辑器使用教程与使用方法 发布时间:2014-08-23 14:23:34.0 作者:青岛做网站 我们在做网站的时候,网站后台系统一般都会用到 ...

  7. 日常问题181101: ueditor文本编辑器

    下载地址: https://ueditor.baidu.com/website/download.html#ueditor 把下载好的文件整个复制到根目录(或是,想要存放的目录) 引入css: < ...

  8. 2016/05/16 UEditor 文本编辑器 使用教程与使用方法

    第一:百度UEditor编辑器的官方下载地址 ueditor 官方地址:http://ueditor.baidu.com/website/index.html 开发文档地址:http://uedito ...

  9. UEditor百度富文本编辑器--让编辑器自适应宽度的解决方案

    UEditor百度富文本编辑器的initialFrameWidth属性,默认值是1000. 不能够自适应屏幕宽度.如图1: 刚开始的时候,我是直接设置initialFrameWidth=null的.效 ...

随机推荐

  1. HDU 2112 HDU Today(Dijkstra)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2112 HDU Today Time Limit: 15000/5000 MS (Java/Others ...

  2. [Network]Wireless and Mobile

    Wireless 1 Introduction 1.1 Elements 1. Wireless Hosts Wireless does not mean mobility. 2. Base Stat ...

  3. 用VLC搭建流媒体server

    VLC开元项目相当强大,我们既能够将其作为播放核心用于二次开发,又能够将其作为高性能的流媒体server.今篇博客主要讲用VLC搭建流媒体server. VLC搭建流媒体server步骤非常easy: ...

  4. javascript面向对象程序设计

    在学习js面向对象编程之前,首先须要知道什么是面向对象.面向对象语言都有类的概念,通过它能够创建具有同样属性和方法的对象.但js并没有类的概念,因此js中的对象和其它语言的对象有所不同. js对象能够 ...

  5. C语言中字符串如何转换为二进制、八进制、十进制、十六进制

    在C语言某个程序当中需要把文本16进制转换成对应的16进制数,比如字符串"0x1a"转换成10进制的26,可以用以下函数来实现 相关函数: atof, atoi, atol, st ...

  6. Boost中timer的简易用法

    boost::asio::deadline_timer timer_; timer_(io_service), timer_.expires_from_now(boost::posix_time::s ...

  7. hdu2712(贪心)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2712 题意:是求最短的非子串(子串不要求连续)的长度. 分析:把序列划分为尽量多(假设为ans)的含有 ...

  8. jdk1.6与1.7垃圾回收

    最近项目中遇到了个关于JVM中GC线程数的问题,做一下简单的总结 问题场景: server:均为 sun公司的solaris 系统 CPU 128个 项目8.1时使用的 java版本:   jdk1. ...

  9. (白书训练计划)UVa 120 Stacks of Flapjacks(构造法)

    题目地址:UVa 120 水题. 从最大的開始移,每次都把大的先翻到最上面,再翻到以下. 代码例如以下: #include <iostream> #include <cstdio&g ...

  10. Android学习-各种对话框

    在android的编程中,对话框的用处是非常多的,然而,有时对对话框的需求也是不一样的,那么现在,就总结对话框的种类,以及事件的处理形势. 1.简单的对话框 public void showDialo ...