...

View Full Version : Problems resizing iframe!



oswald8
06-10-2008, 05:46 AM
:eek:Hi! I found this code online that could make my iframe vary height depending on its content. It works awsomely in IE, but in mozilla firefox, it's a diffrent story! The frame expands well with the content, but it never shrinks back. Can anyone help me?

here's my page: www.luckyoswald.net (http://www.luckyoswald.net)

For the code, I pasted this in the head of my main page (the one that contains the iframe)
------------------------

<script language="JavaScript">
<!--
function calcHeight()
{
//find the height of the internal page
var the_height=
document.getElementById('the_iframe').contentWindow.
document.body.scrollHeight;

//change the height of the iframe
document.getElementById('the_iframe').height=
the_height;
}
//-->
</script>

------------------------



and this is my iframe tag
------------------------

<iframe width="741" id="the_iframe"
onLoad="calcHeight();"
onload=resize_iframe
src="blog.htm"
scrolling="no"
frameborder="0"
height="1" marginwidth="1" marginheight="1" name="I1" border="0">
</iframe>

------------------------



thanks in advance!

fside
06-10-2008, 06:41 AM
There a short routine to get the 'handle' of an iframe's contents in the 4th message in the Add/Hide thread in the post-a-javascript section. It might help.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum