«
自适应高度宽度的iframe代码

时间:2011-9-21    作者:Deri    分类: 分享


<bgsound src="zhenaiwudi.wma" loop="-1">

<div class="bg"><img src="images/bg.jpg" width="0" /></div>

<script type="text/javascript">

function reinitIframe(){

var iframe = document.getElementById("uu");

try{

var bHeight = iframe.contentWindow.document.body.scrollHeight;

var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;

var height = Math.max(bHeight, dHeight);

var btitle = iframe.contentWindow.document.title;

iframe.height = height;

document.title = btitle;

}catch (ex){}

}

window.setInterval("reinitIframe()", 200);

</script>

<center>

<iframe src="main.html" id="uu" marginWidth="0" marginHeight="0" frameBorder="0" width="100%" scrolling="no"></iframe>

</center>