19
2012
08

Asp.net百度UEditor文本编辑器使用说明

简单贴出代码,可以下载

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>UEditor非控件渲染示例</title>
    <link rel="stylesheet" type="text/css" href="/UEditor/themes/default/ueditor.css" />
    <script src="/UEditor/editor_config.js" type="text/javascript"></script>
<script src="/UEditor/editor_all.js" type="text/javascript"></script>
</head>
<body>
    <form id="form1" runat="server">
    <fieldset>
        <legend>获取内容操作</legend>
        <input id="Button1" type="button" value="JS获取第一个编辑器内容" onclick="alert(UEditor1.getContent())" />
        <asp:Button ID="Button2" runat="server" Text="后台获取第一个编辑器内容" OnClick="Button2_Click" />
                <input id="Button3" type="button" value="JS获取第二个编辑器内容"  onclick="alert(UEditor2.getContent())" />
        <asp:Button ID="Button4" runat="server" Text="后台获取第二个编辑器内容" OnClick="Button4_Click" />
    </fieldset>
    <fieldset>
        <legend>后台获取到的HTML内容</legend>
        <div id="divHtml" runat="server">
        </div>
    </fieldset>
    <br />
    <fieldset style=" height:300px;">
        <legend>第一个编辑器</legend>
     <textarea name="UEditor1" id="UEditor1" rows="4" cols="40" wrap="virtual"></textarea>
        <script type="text/javascript">
            var option = {};
            var UEditor1 = new baidu.editor.ui.Editor(option);
            UEditor1.render('UEditor1');
        </script>
</fieldset>
    <fieldset style=" height:200px;">
        <legend>第二个编辑器</legend>
     <textarea name="UEditor2" id="UEditor2" rows="4" cols="40" wrap="virtual"></textarea>
        <script type="text/javascript">
            var option = {minFrameHeight:100};
            var UEditor2 = new baidu.editor.ui.Editor(option);
            UEditor2.render('UEditor2');
        </script>
</fieldset>
    </form>
</body>
</html>
 

    protected void Button2_Click(object sender, EventArgs e)
    {
        divHtml.InnerHtml = Request.Form["UEditor1"];
    }
    protected void Button4_Click(object sender, EventArgs e)
    {
        divHtml.InnerHtml = Request.Form["UEditor2"];
    }

下载地址

« 上一篇下一篇 »

评论列表:

文章不错!支持i型啊!
2.韩佳伦  2012/8/21 14:42:48 回复该留言
不错,学习了

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。