Thursday, May 14, 2009

Auto expand/adjustable iframe

Below is some javascript code that will automatically expand the iframes that we currently use to embed forms.
(1) Paste The blow to the head


<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>


(2)Paste the code below to the body and replace "your page here" with your url



<iframe width="100%" id="the_iframe"
onLoad="calcHeight();"
src="your page here"
scrolling="NO"

frameborder="0"
height="1">
An iframe capable browser is
required to view this web site.
</iframe>

1 comment:

David Stone said...

External website auto-resizable iframes can be found at this url: http://geekswithblogs.net/rashid/archive/2007/01/13/103518.aspx.

Cheers!