html
1 <iframe src="index.html" id="iframepage" frameborder="0" scrolling="no" onLoad="iFrameHeight()"></iframe>
script
1 <script> 2 function iFrameHeight() { 3 var ifm = document.getElementById("iframepage"); 4 var subWeb = document.frames ? document.frames["iframepage"].document : ifm.contentDocument; 5 if (ifm != null && subWeb != null) { 6 ifm.height = subWeb.body.scrollHeight; 7 ifm.width = subWeb.body.scrollWidth; 8 } 9 } 10 </script>
时间: 2024-11-21 02:53:34