1 // js函数iframe的高度自动根据引用页面的高度变化 2 < script type = " text/javascript " > 3 function SetWinHeight(obj) 4 { 5 var win=obj; 6 if (document.getElementById) 7 { 8 if (win && !window.opera) 9 {10 if (win.contentDocument && win.contentDocument.body.offsetHeight) 11 win.style.height = win.contentDocument.body.offsetHeight;12 else if(win.Document && win.Document.body.scrollHeight)13 win.style.height = win.Document.body.scrollHeight;14 }1516 }17 } 18 19 // 引用 20 < iframe width = " 100% " frameborder = " 0 " id = " ifr " name = " ifr " src = " mindex.html " onload = " SetWinHeight(this) " scrolling = " no " ></ iframe > 0 0 0 (请您对文章做出评价) 转载于:https://www.cnblogs.com/Gsun/archive/2010/03/30/1700434.html