2012-03-17 9 views
0

私はiBookのiframeにTinyMCEエディタを作成し、iframeの外側にボタンがあります。私の問題は、ボタンクリックでエディタの値を取得するtaht iwantですが、私は何も見つからなかっボタンをクリックしたときに、ここで助けてください私のコードTiny MCE Editor in 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コード:Button1の中興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()); 
    }); 

}); 

私はTinyMCEをのオブジェクトが見つかりましたが値を取得することはできませんTinyMCEのをalthougの何も見つからなかったあなたの問題を解決するには、getContent()を使用するのが良いかもしれないjqueryの

答えて

0

を使用してサイド私はtimyMCEの値を取得することができますどのようにボタンのクリックではiframeを助けてくださいgetCOntent()の代わりに。 getCOntent()を使用すると、JavaScriptエラーが発生するはずです。

+0

私もgetContent()を使用しますが、値は未定義です –

+0

tinymce()の代わりにtinymce.get( "TemplateEditor")を使用してくださいget( "TemplateEditor")! – Thariama

関連する問題