This Javascript works with Firefox and IE7. The function is called by the iframe’s onLoad event. It pulls the scrollbar height from the frame and resizes the frame height to match it.
<script language=”text/javascript”>
<!–
function calcHeight()
{
var the_height=
document.getElementById(’submit_frame’).contentWindow.
document.body.scrollHeight;document.getElementById(’submit_frame’).style.height=
(the_height+10)+”px”;
}
//–>
</script>
And use the following HTML for the iframe.
<iframe src=”frame.html” onLoad=”calcHeight();” scrolling=”no” id=”submit_frame” style=”width: 400px”></iframe>







No user commented in " Dynamic Iframe Sized to Contents w/ Javascript "
Follow-up comment rss or Leave a TrackbackLeave A Reply