簡體   English   中英

從框架集獲取InnerHTML

[英]Get InnerHTML from Frameset

我正在嘗試將FrameSet的innerHTML導出到excel(.xlsx)。 有沒有辦法像“ this.document.getElementById('completeFrameSet')。InnerHTML”這樣的JavaScript?

<frameset onLoad="init()" onResize="balken()" framespacing="0" frameborder="0" cols="286,*" id="completeFrameSet">
   <frameset id="links" rows="32,*">
     <frame marginheight="0" marginwidth="0" scrolling="no" name="obLi" src="content_LeftTop.php >
     <frame marginheight="0" marginwidth="0" scrolling="no" name="untLi" src="content_LeftBottom.php">
   </frameset>
   <frameset id="rechts" rows="32,*">
     <frameset id="oben" cols="*,13">
        <frame marginheight="0" marginwidth="0" scrolling="no" name="obRe" src="content_RightTop.php">
        <frame scrolling="no" src="leer.html">
     </frameset>
     <frame marginheight="0" marginwidth="0" scrolling="auto" name="untRe" src="content_RightBottom.php">
   </frameset>
</frameset>

問候,凱文

//Here is how i get the content of the body of a iframe
var iframeElement = document.getElementById('myFrame');
var iframeDocument = iframeElement.contentDocument || iframeElement.contentWindow.document;
var frameContent = iframeDocument.getElementsByTagName('BODY')[0].innerHTML;

感謝algorhythm回答

嘗試使用不帶前綴“ this”的document.getElementById('element')。innerhtml。 您還可以使用庫jQuery並使用方法$(element).html()。 它還以字符串形式返回元素的內容

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM