Posted By

dottDesign on 06/09/10


Tagged

iframe javascript auto


Versions (?)

Auto Height iFrame


 / Published in: Other
 

  1. Use this javascript function in your frame page..
  2.  
  3. "
  4. function resizeIframe(iframeID) {
  5. if(self==parent) return false; /* Checks that page is in iframe. */
  6. else if(document.getElementById&&document.all) /* Sniffs for IE5+.*/
  7.  
  8. var FramePageHeight = framePage.scrollHeight + 10; /* framePage
  9. is the ID of the framed page's BODY tag. The added 10 pixels prevent an
  10. unnecessary scrollbar. */
  11.  
  12. parent.document.getElementById(iframeID).style.height=FramePageHeight;
  13. /* "iframeID" is the ID of the inline frame in the parent page. */
  14. }
  15. "
  16. and run it on load
  17.  
  18. "<body id="framePage" onload="resizeIframe('idTopFrame')">"

Report this snippet  

You need to login to post a comment.