2012-03-17 119 views
0

我有一個HTML網頁,我在iframe中起訴TinyMCE編輯器,我有一個按鈕,這是在iframe外側。我的問題是taht iwant獲得上按一下按鈕編輯器的值,但是當我點擊按鈕,我什麼也沒找到,請幫助這裏是我的代碼微小的MCE編輯器在iframe

,iframe代碼:

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

UploadTemplates.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的興jQuery的我的點擊沒有發現TinyMCE althoug我發現tinyMCE的對象,但無法獲得價值,請幫助我如何獲得timyMCE的外側iframe上的按鈕點擊使用jquery

回答

0

您的問題的解決方案可能是getContent()而不是getCOntent()。 使用getCOntent()你應該得到javascript錯誤!

+0

我也使用getContent()但值不確定 – 2012-03-19 14:43:46

+0

使用tinymce.get(「TemplateEditor」)而不是tinymce()。get(「TemplateEditor」)! – Thariama 2012-03-20 08:31:26