代码简单,兼容性还可以
<script>
function SetWinHeight(obj) { var win=obj; if (document.getElementById) { if (win && !window.opera) { if (win.contentDocument && win.contentDocument.body.offsetHeight) win.height = win.contentDocument.body.offsetHeight; else if(win.Document && win.Document.body.scrollHeight) win.height = win.Document.body.scrollHeight; } } }</script>
最后,加入iframe,不能丢掉onload属性,当然了,id也必须也函数中的win匹配
<iframe height="200" id="win" name="win" οnlοad="Javascript:SetWinHeight(this)" frameborder="0" scrolling="no" src="1.htm"></iframe>