IFRAME is generally not considered a good idea to use but sometimes it really helps. But resizing an IFRAME as per the content is a big issue and I found a piece of code after some search which can resolve this issue.
<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>
<iframe width="700" id="the_iframe"
 onLoad="calcHeight();"
 src="testing_page.shtml"
 scrolling="NO"
 frameborder="1"
 height="1">
</iframe>
Reference:  http://guymal.com/mycode/iframe_size/
 
No comments:
Post a Comment