//JS函數
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;
}
}
}
最後,加入iframe,不能丟掉onload屬性,當然了,id也必須也函數中的win匹配
<iframe width="778" align="center" height="200" id="win" name="win" οnlοad="Javascript:SetWinHeight(this)" frameborder="0" scrolling="no" src="1.htm"></iframe>