[转]OBOUT ASP.NET HTML Editor - Insert HTML
2015-10-09 09:50
633 查看
本文转自: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
具体实例效果见 http://www.obout.com/editor_new/sample_InsertHTML.aspx
另有:http://www.obout.com/Obout.Ajax.UI/HTMLEditor/examples/CSAPI_insertHTML.aspx
具体实例效果见http://www.obout.com/Obout.Ajax.UI/HTMLEditor/examples/CSAPI_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(); }
相关文章推荐
- asp.net mvc web api 可跨域方法
- spring @AspectJ @annotation
- ASP.NET如何定时调用WebService服务
- 表单和 HTML 辅助方法– ASP.NET MVC 4 系列
- ROS(10):mac 下树莓派Raspberry Pi 烧录 img
- Asp.net mvc + .net ef database first 或 model first 时如何添加验证特性
- Asp.net页面间传值方式汇总
- Unable to locate 'C:\Users\Administrator\Desktop\aspnet-3f34254d5ebec499ba8bc470544c7d401f379406\Sam
- Asphyre 更名pxl 终于全面支持跨平台了.Delphi饭们 激动了吧.
- ASP.NET动态网站制作(7)-- JS(2)
- asp.net MVC 中呈现指定区域下的分部视图
- asp.net MVC 中呈现指定区域下的分部视图
- 如何利用iis的缺陷配置system权限的asp后门 - tk
- ASP.NET中HTML页面的访问验证设置方法
- Spring @Aspect进行类的接口扩展
- OWASP Top 10 – 2013, 最新十大安全隐患(ASP.NET解决方法)
- ASP显示页面执行时间的方法
- 未能找到元数据文件C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\..\IDE\EntityFramework.dl
- ASP编码和解码函数详解
- Asp.net Web.Config - 配置元素 trace