JavaScript native and jquery libraries implement IFRAME adaptive content heights and widths---Use jquery's code!
<iframe src= "index.php" id= "Mainiframe" name= "Mainiframe" width= "100%" frameborder= "0" scrolling= "no" marginwidth= "0" marginheight= "0" ></iframe>
The code based on the jquery library is well implemented:
<script language= "javascript" type= "Text/javascript" >
$ (document). Ready (function () {
$ ("#mainframe"). Load (function () {
$ (this). Height (0); Control iframe height initialization for each refresh
var height = $ (this). Contents (). Height () + 10;
$ (this). Height (height < 500:height);
});
});
</script>
Based on the JS native code implementation:
<script language= "JavaScript" >
if (window.parent.length>0) {window.parent.document.all.mainframe.style.height=document.body.scrollheight;}
</script>
Just add the above paragraph after you've been called by the IFRAME </body>!
This can also control the height of the iframe automatically grows with the content
<iframe name= "web" width= "100%" frameborder=0 height= "100%" src= "index.php" id= "web" onload= "this.height= Web.document.body.scrollheight+20 "></iframe>jquery Library implements IFRAME adaptive content height and width