【问题标题】:Tiny MCE Editor In iframe在 iframe 中的 Tinymce 编辑器
【发布时间】:2012-03-19 16:38:12
【问题描述】:

我有一个 html 页面,我在 iframe 中使用 TinyMCE 编辑器,并且我有一个位于 iframe 外侧的按钮。我的问题是我想在按钮单击时获得编辑器的值但是当我单击按钮时我什么也没找到请帮助这里是我的代码

iframe 代码:

<iframe id="EditorFrame" src="UploadTemplates.aspx" frameborder="0" style="height: 900px;
            width: 1000px" scrolling="auto"></iframe>

上传模板.aspx 代码:

<div>
        <p>
            <textarea id="TemplateEditor" cols="50" rows="50" runat="server">
            </textarea>
        </p>
    </div>

jQuery 代码:

$(function () {
    uploader = $("#TempateFileUploader");
    tinyMCE.init({
        // General options
        mode: "textareas",
        theme: "advanced",
        plugins: "autolink,lists,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
        theme_advanced_toolbar_location: "top",
        theme_advanced_toolbar_align: "left",
        theme_advanced_statusbar_location: "bottom",
        theme_advanced_resizing: false,
        width: "800",
        height: "640"
        //        setup: function (ed) {
        //            ed.onClick.add(function (ed, e) {
        //                alert('Editor was clicked: ' + e.target.nodeName);
        //            });
        //        }

    });

$("#Button1").click(function () {
        alert(tinymce().get("TemplateEditor").getCOntent());
    });

});

在单击 Button1 hsing Jquery 时,我没有发现 TinyMCE 的任何内容,尽管我找到了 tinyMCE 的对象但无法获得值,请帮助我如何在使用 jquery 的按钮单击时从 iframe 之外获取 timyMCE 的值

【问题讨论】:

    标签: iframe tinymce


    【解决方案1】:

    您的问题的解决方案可能是使用 getContent() 而不是 getCOntent() 。 使用 getCOntent() 你应该得到 javascript 错误!!

    【讨论】:

    • 我也使用 getContent() 但值未定义
    • 使用 tinymce.get("TemplateEditor") 代替 tinymce().get("TemplateEditor") !
    猜你喜欢
    • 2022-11-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-12-06
    • 1970-01-01
    相关资源
    最近更新 更多