Iframe 高度自适应!

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 src='../DocumentManage/ToUploadFile.aspx' scrolling=no width='100%' height='100%' frameborder='no' onload='Javascript:SetWinHeight(this);'/>


很方便!
posted @ 2008-05-08 12:09  NewSea  阅读(255)  评论(1编辑  收藏  举报