使用此功能玩弄後,我注意到,HTML看起來像這樣:
<iframe id = "Some iFrameId">
#document
<html>
<head>...</head>
<body>The text of the editor</body>
</html>
</iframe>
在ASPX,我做了以下使我的生活痘痘更容易一點:
<div id ="myDiv" ClientIDMode="Static">
<ajaxToolkit:Editor ID="Editor" runat = "server" />
</div>
通過這樣做,我簡化了我的問題,以便找到包含在編輯器的HTML myDiv中的iFrame。
要做到這一點的JS
//get the iFrame
var myIframe = $("#myDiv, iframe") //this returns an array and myIframe[1] is the iFrame, which contains the text.
//get the HTML from the iFrame
var content = myIFrame[1].contentWindow.document.body.innerHTML;
現在內容包含,我一直在尋找。這是很長的,可能有一個更簡單的方法,但在尋找解決方案後,我發現其中大部分是:
做一個.get_content或某個函數調用,這對我的情況不起作用。
來源
2012-10-25 20:27:01
Rhs