0

i am trying to export the innerHTML from a FrameSet to excel (.xlsx). Is there a way für JavaScript like "this.document.getElementById('completeFrameSet').InnerHTML" ?

<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>

Greets, Kevin

Kevin Busch
  • 191
  • 1
  • 4
  • 17
  • Could you describe in more detail your problem? you are looking for an alternative way to get the contents, not using "document.getElementById('completeFrameSet').InnerHTML"? – Hleb Mar 26 '12 at 12:22
  • it tells me "undefined" :) so i need a way to get all the HTML data inside my Frameset. Which way i use isn't important for me. – Kevin Busch Mar 26 '12 at 12:33
  • could this help: http://stackoverflow.com/a/11107977/2835520 – IgniteCoders May 08 '15 at 07:14

2 Answers2

0
//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;

thanks to algorhythm for answer

Community
  • 1
  • 1
IgniteCoders
  • 4,834
  • 3
  • 44
  • 62
0

Try to use document.getElementById('element').innerhtml without the prefix "this." You can also use the library jQuery and use the method $(element).html(). It also returns the contents of the element as a string

Hleb
  • 7,037
  • 12
  • 58
  • 117
  • hehe, now i am getting the html-code that i have written above. But not the html, the .php-sites has generated. I try to get the result from my complete frameset. – Kevin Busch Mar 26 '12 at 13:03
  • I am not familiar with the PHP, but I hope that was helpful to you:) – Hleb Mar 26 '12 at 14:13
  • no sorry, not veeeeery helpful :-) i try to get the complete HTML-Content after the page was built. If i make some database selects and display the results with one PHP file, i try to get all the generated content with one click. – Kevin Busch Mar 27 '12 at 12:22
  • I do not understand very well the purpose of what you want to do. That is, you need to get the content of the page after it is full load, save the content in the repository and use the data from there?.. – Hleb Mar 27 '12 at 13:50
  • i generate a Table (okay, they are 4 tables) in the frameset -TopRight is the Header (productname) -BottomLeft are the Titles of Types of fields (price, description...) -bottomRight is the content for each product Each Frameset is generated inside PHP Now, i want to do a export (quick and dirty) to excel. You can save HTML-Tables into Excel-files. So i try to get the tables and push them into the excel. – Kevin Busch Mar 27 '12 at 14:00
  • I found a [topic](http://stackoverflow.com/questions/6566831/how-to-export-html-table-to-excel-using-javascript) that describes how to export html table to excel – Hleb Mar 27 '12 at 14:15
  • Thank you, but it's possible to save a HTML-File as xlsx :) But i will try to use your topic. Thank u. – Kevin Busch Mar 28 '12 at 05:28