如何將iframe的高度設成和它的內容相等

1.於iframe內的頁面取得該頁面的總高度.
2.將總高度連到parent頁,設成iframe的高度

代碼如下:
function iframe_heigth()
{
var iframeid = parent.document.getElementById('iframeid');
var iframe_height = document.body.clientHeight;
iframeid.style.height = iframe_height+"px";
}

沒有留言: