Shawn05
12-18-2005, 07:41 PM
HI there. I am looking to try and figure out how to change the height of an iframe everytime a new page is loaded inside of it. I currently can change it onLoad of the initial iframe but not after something else is loaded inside of it. Here is what I currently have
<script language="JavaScript">
<!--
function calcHeight()
{
//find the height of the internal page
var the_height=
document.getElementById('iframe').contentWindow.
document.body.scrollHeight;
//change the height of the iframe
document.getElementById('iframe').height=
the_height;
}
//-->
</script>
Then the actual iframe
<iframe onLoad="calcHeight();" width="600" id="iframe" src="somepage.php" scrolling="NO" frameborder="0" height="100">An iframe capable browser is required to view this web site.</iframe>
Any help would be great. Thank you.
<script language="JavaScript">
<!--
function calcHeight()
{
//find the height of the internal page
var the_height=
document.getElementById('iframe').contentWindow.
document.body.scrollHeight;
//change the height of the iframe
document.getElementById('iframe').height=
the_height;
}
//-->
</script>
Then the actual iframe
<iframe onLoad="calcHeight();" width="600" id="iframe" src="somepage.php" scrolling="NO" frameborder="0" height="100">An iframe capable browser is required to view this web site.</iframe>
Any help would be great. Thank you.