天天看點

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="bn_mid.jsp" onload="Javascript:SetWinHeight(this)"></iframe>

本文轉自 winters1224 51CTO部落格,原文連結:http://blog.51cto.com/winters1224/797785,如需轉載請自行聯系原作者

繼續閱讀