2020国产成人精品视频,性做久久久久久久久,亚洲国产成人久久综合一区,亚洲影院天堂中文av色

分享

JavaScript應用:Iframe自適應其加載的內(nèi)容高度

 昵稱8331 2006-06-16

//main.htm:

<html>
<head>
<meta http-equiv=‘Content-Type‘ content=‘text/html; charset=gb2312‘ />
<meta name=‘a(chǎn)uthor‘ content=‘F.R.Huang(meizz梅花雪)//www.meizz.com‘ />
<title>iframe自適應加載的頁面高度</title>
</head>

<body>
<iframe src="child.htm"></iframe>
</body>
</html>

//child.htm:

<html>
<head>
<meta http-equiv=‘Content-Type‘ content=‘text/html; charset=gb2312‘ />
<meta name=‘a(chǎn)uthor‘ content=‘F.R.Huang(meizz梅花雪)//www.meizz.com‘ />
<title>iframe 自適應其加載的網(wǎng)頁(多瀏覽器兼容)</title>
<script type="text/javascript">
<!--
function iframeAutoFit()
{
var ex;
try
{
if(window!=parent)
{
var a = parent.document.getElementsByTagName("IFRAME");
for(var i=0; i<a.length; i++) //author:meizz
{
if(a[i].contentWindow==window)
{
var h1=0, h2=0;
if(document.documentElement&&document.documentElement.scrollHeight)
{
h1=document.documentElement.scrollHeight;
}
if(document.body) h2=document.body.scrollHeight;

var h=Math.max(h1, h2);
if(document.all) {h += 4;}
if(window.opera) {h += 1;}
a[i].style.height = h +"px";
}
}
}
}
catch (ex){}
}
if(document.attachEvent)
{
window.attachEvent("onload", iframeAutoFit);
window.attachEvent("onresize", iframeAutoFit);
}
else
{
window.addEventListener(‘load‘, iframeAutoFit, false);
window.addEventListener(‘resize‘, iframeAutoFit, false);
}
//-->
</script>
</head>
<body>
<table border="1" width="200" style="height: 400px; background-color: yellow">
<tr>
<td>iframe 自適應其加載的網(wǎng)頁(多瀏覽器兼容,支持XHTML)</td>
</tr>
</table>
</body>
</html>

    本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導購買等信息,謹防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊一鍵舉報。
    轉(zhuǎn)藏 分享 獻花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多