tushar707 Posted May 21, 2007 Share Posted May 21, 2007 Hello, I have an iframe that changes its content according to the menu. How do I have the iFrame adjust its height according to content? Also how do I have the content area where the iframe is located to adjust its height according to the iframe? -tushar Quote Link to comment Share on other sites More sharing options...
tushar707 Posted May 21, 2007 Author Share Posted May 21, 2007 please close the topic as I have solved it. Quote Link to comment Share on other sites More sharing options...
Kizzie33 Posted February 6, 2010 Share Posted February 6, 2010 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> I hope this helps others wonting this solution Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.