//包括设置父DIV的高度,至于第几层才是正确的,自己调试找正确的高度了
function SetWinHeight(obj)
{
//debugger
var win = obj;
if(document.getElementById)
{
if (win && !window.opera)
{
if (win.parentNode && win.parentNode.parentNode && win.parentNode.parentNode.parentNode && win.parentNode.parentNode.parentNode.clientHeight)
{
win.height = win.parentNode.parentNode.parentNode.clientHeight;
win.parentNode.style.height = win.height;
win.parentNode.parentNode.style.height = win.height;
}
}
}
}
<iframe id="iframeRightMRS" οnlοad="Javascript:SetWinHeight(this)" name="iframeRightMRS" width="230" height="100%" align="center" src="/Home/RightMRS" frameborder="0" scrolling="no"></iframe>
//iframe子页面中:
// 取得iframe框架的高度,,这个高度已经在主页上自动设置了
var panelheight = parent.document.all("iframeRightMRS").offsetHeight
if (panelheight != null && panelheight != 0)
{
panelheight = panelheight - 1;
}