本文转自:http://www.obout.com/editor_new/sample_InsertHTML.aspx

Example demonstrates how to access HTML Editor's content at current selection/caret position from "outside" component.

Example code

<script type="text/JavaScript">
function Insert()
{
oboutGetEditor('editor').InsertHTML("<a href='mailto://support@obout.com'>Obout support</a>");
}
</script> <input type="button" onclick="Insert();" value="Insert Obout support link"/>
<ed:Editor id="editor" runat="server" />

具体实例效果见 http://www.obout.com/editor_new/sample_InsertHTML.aspx

另有:http://www.obout.com/Obout.Ajax.UI/HTMLEditor/examples/CSAPI_insertHTML.aspx

Obout.Ajax.UI Controls - HTML Editor - Insert HTML code in the current cursor position

<%@ Register Assembly="Obout.Ajax.UI" Namespace="Obout.Ajax.UI.HTMLEditor" TagPrefix="obout" %>
<input type="button" onclick="InsertLink();" value="Insert Obout support link"/>
<br /><br />
<obout:Editor runat="server" Id="editor" Width="100%" >
<TopToolbar PreservePlace="true" />
<EditPanel Height="400px" />
</obout:Editor>
...
<script type="text/javascript">
function InsertLink() {
// get the EditPanel
var editPanel = $find("<%= editor.ClientID %>").get_editPanel();
// can be inserted in 'Design' mode only
if (editPanel.get_activeMode() == Obout.Ajax.UI.HTMLEditor.ActiveModeType.Design) {
// save content for 'Undo' operation
editPanel.get_activePanel().SaveContent();
// insert HTML into current caret position
editPanel.get_activePanel().insertHTML("<a href='mailto://support@obout.com'>Obout support</a>");
}
}
</script>

具体实例效果见http://www.obout.com/Obout.Ajax.UI/HTMLEditor/examples/CSAPI_insertHTML.aspx

                var editPanel = Obout.Ajax.UI.HTMLEditor.LastFocusedEditPanel;
// if the current mode is 'Design'
if (editPanel != null && editPanel.get_activeMode() == Obout.Ajax.UI.HTMLEditor.ActiveModeType.Design) { alert(varHtmlContent); // get the DesignPanel's object var designPanel = editPanel.get_activePanel(); // For 'Undo' designPanel._saveContent(); // What to do - insert some text at current selection //--------------------------------------------------- designPanel.insertHTML("" + "$$" + varHtmlContent + "$$" + ""); //--------------------------------------------------- // Notify Editor about content changed and update toolbars linked to the edit panel // setTimeout(function () { designPanel.onContentChanged(); editPanel.updateToolbar(); }, 0); // Ensure focus in design panel designPanel.focusEditor(); }

[转]OBOUT ASP.NET HTML Editor - Insert HTML的更多相关文章

  1. Obout - ASP.NET HTML Editor

    ASP.NET MVC HTML Editor http://www.obout.com/mvc-editor/index.aspx http://www.obout.com/index.aspx H ...

  2. ASP.NET页面与IIS底层交互和工作原理详解

    转载自:http://www.cnblogs.com/lidabo/archive/2012/03/13/2393200.html 第一回: 引言 我查阅过不少Asp.Net的书籍,发现大多数作者都是 ...

  3. ASP.NET页面与IIS底层交互和工作原理详解(第一回)

    引言 我查阅过不少Asp.Net的书籍,发现大多数作者都是站在一个比较高的层次上讲解Asp.Net.他们耐心.细致地告诉你如何一步步拖放控件.设置控件属性.编写CodeBehind代码,以实现某个特定 ...

  4. 在线编辑器ACE Editor的使用

    ACE 是一个开源的.独立的.基于浏览器的代码编辑器,可以嵌入到任何web页面或JavaScript应用程序中.ACE支持超过60种语言语法高亮,并能够处理代码多达400万行的大型文档.ACE开发团队 ...

  5. Asp.Net构架(Http请求处理流程)、(Http Handler 介绍)、(HttpModule 介绍)

    Asp.Net构架(Http请求处理流程) Http请求处理流程概述 对于普通访问者来说,这就像每天太阳东边升起西边落下一样是理所当然的:对于很多程序员来说,认为这个与己无关,不过是系统管理员或者网管 ...

  6. ACE Editor在线代码编辑器简介及使用引导

    转自博客:https://www.cnblogs.com/cz-xjw/p/6476179.html ACE 是一个开源的.独立的.基于浏览器的代码编辑器,可以嵌入到任何web页面或JavaScrip ...

  7. DevExpress v17.2新版亮点—ASP.NET篇(二)

    用户界面套包DevExpress v17.2终于正式发布,本站将以连载的形式为大家介绍各版本新增内容.本文将介绍了DevExpress ASP.NET v17.2 的GridView Control. ...

  8. Asp.Net构架(Http请求处理流程) - Part.1

    引言 我查阅过不少Asp.Net的书籍,发现大多数作者都是站在一个比较高的层次上讲解Asp.Net.他们耐心.细致地告诉你如何一步步拖放控件.设置控件属性.编写CodeBehind代码,以实现某个特定 ...

  9. Asp.Net构架(Http请求处理流程)

    一:引言 我查阅过不少Asp.Net的书籍,发现大多数作者都是站在一个比较高的层次上讲解Asp.Net.他们耐心.细致地告诉你如何一步步拖放控件.设置控件属性.编写CodeBehind代码,以实现某个 ...

随机推荐

  1. Avisynth + DirectShow + WebCamera 实现Avisynth脚本访问摄像头

    准备工作:需要以下三种软件 1.Avisynth_258 安装文件和源码下载地址(Avisynth_258.exe 4.2 MB) http://sourceforge.net/projects/av ...

  2. codeforces B. Permutation 解题报告

    题目链接:http://codeforces.com/problemset/problem/359/B 题目意思:给定n和k的值,需要构造一条长度为2n(每个元素取值范围只能是[1,2n])且元素各不 ...

  3. 高阶函数复习:利用reduce和map把字符串转为数字

    复习高阶函数的时候,有一道题想了半天解不出来.看了下别人的解法,发现学习编程,思维真的很重要. 习题: 利用map和reduce编写一个str2float函数,把字符串'123.456'转换成浮点数1 ...

  4. intellij 2016注册

    第一种方法: http://idea.qinxi1992.cn http://idea.imsxm.com/ http://107.191.37.186:11688

  5. 了解 hadoop

    <Hadoop基础教程>之初识Hadoop 博客分类: 读后感   Hadoop一直是我想学习的技术,正巧最近项目组要做电子商城,我就开始研究Hadoop,虽然最后鉴定Hadoop不适用我 ...

  6. SQL 查询CET使用领悟

    用到sql的遍历循环查询,如果不考虑用CET,估计又到了自己造轮子的时代了,现在觉得sql的CET确实是个好东西,针对SQL的递归查询,很是不错的方法: with etcRecommandINfo2( ...

  7. Laravel 4 系列入门教程(一)

    默认条件 本文默认你已经有配置完善的PHP+MySQL运行环境,懂得PHP网站运行的基础知识.跟随本教程走完一遍,你将会得到一个基础的包含登录的简单blog系统,并将学会如何使用一些强大的Larave ...

  8. 微信聊天测试脚本 wx_sample.php

    <?php </FuncFlag>                             </xml>);         curl_setopt($ch, CURLO ...

  9. .Net的后台服务技术有哪些?

    ashx(一般处理程序)WCFWebServiceASP.NET Web API 1 ashx(一般处理程序) 一 般处理程序(HttpHandler)是·NET众多web组件的一种,ashx是其扩展 ...

  10. Sql Server REPLACE函数的使用

    REPLACE用第三个表达式替换第一个字符串表达式中出现的所有第二个给定字符串表达式. 语法REPLACE ( ''string_replace1'' , ''string_replace2'' , ...