Return to Snippet

Revision: 8932
at October 14, 2008 13:16 by jamesming


Initial Code
<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 in the body create the iframe tag:

<iframe width="700" id="the_iframe" 
	onLoad="calcHeight();" 
	src="testing_page.shtml" 
	scrolling="NO" 
	frameborder="1" 
	height="1">
An iframe capable browser is 
required to view this web site.
</iframe>

Initial URL
http://guymal.com/mycode/iframe_size/

Initial Description


Initial Title
Resizing an iframe according to its contents

Initial Tags


Initial Language
JavaScript