js代码让iframe框架自适应高度 2014年10月29日

<script type="text/javascript">

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;

}

}

}

</script>

<iframe frameborder="0" id="main_right" name="main_right" src="http://www.198zone.com" scrolling="auto" height="500" title="main_right" onload="Javascript:SetWinHeight(this)" ></iframe>

 

共有 2 条评论

  1. 美容护肤

    小妹新站 http://2meirong.cn 特来拜会,望博主多多支持,祝贵站越办越好!

You must be logged in to post a comment.