iframe自适应高度

来源:互联网 发布:vb select case 编辑:程序博客网 时间:2024/04/30 00:34

function SetWinHeight(obj)
{
    varwin=obj;
    if(document.getElementByIdx)
    {
       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 width="778" align="center" height="200"id="win" name="win" onload="Javascript:SetWinHeight(this)"frameborder="0"scrolling="no"></iframe>


#Js