IFrame高度自适应js脚本

来源:互联网 发布:淘宝产品怎么加工 编辑:程序博客网 时间:2024/05/20 21:22

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 width=”778″ align=”center” height=”200″ id=”win” name=”win” onload=”Javascript:SetWinHeight(this)” frameborder=”0″ scrolling=”no”></iframe>