Hi,
I have this javascript code that resizes an Iframe according to its contents height. It works, but the Iframe does not downsize for smaller pages.
It will only keep resizing if the pages get bigger. So, after viewing a page thats really long, then viewing a page that is really small, its displayed with a lot of empty space.
I was hoping some one could please help modify the code. I need it to "shrink" too!
I have this in the <head> of the page that is being loaded/viewed in the Iframe.
Quote:
<script language="javascript" type="text/javascript">
<!--
function resizeIframe() {
if(self==parent) return false; /* Checks that page is in iframe. */
else if(document.getElementById&&document.all) /* Sniffs for IE5+.*/
var FramePageHeight = framePage.scrollHeight; /* framePage
is the ID of the framed page's BODY tag.
parent.document.getElementById('content_frame_id_n ame').style.height=FramePageHeight;
/* "content_frame_id_name" is the ID of the inline frame in the parent page. */
}
//-->
</script>
|
This is in the body tag of the same page
Quote:
|
<body id='framePage' onload='resizeIframe()'>
|
I also would like this to work in most common browsers. So, if you have any comments on this, please let me know.
Thank you