亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

框架頁面高度自動刷新的Javascript腳本

 更新時間:2013年11月01日 17:29:10   作者:  
框架頁面高度自動刷新,加載index.htm時候,每隔1秒鐘自動調(diào)用腳本刷新框架頁面代碼,具體實現(xiàn)如下,感興趣的朋友可以了解下
實現(xiàn)原理:加載index.htm時候,每隔1秒鐘自動調(diào)用腳本刷新框架頁面代碼
代碼優(yōu)點:只需要設(shè)置index.html框架頁面中的腳本,調(diào)用加載的子頁面中不需要設(shè)置任何代碼。
index.htm代碼如下:
復制代碼 代碼如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>首頁</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<div style="float: left; width: 740px; height:auto; border: 1px #808080 Solid; margin: 5px 0px 5px 10px;overflow: hide">
<iframe name="ifr_obj" id="ifr_obj" src="這里嵌套其它頁面地址或者文件名" frameborder="0" width="100%" scrolling="no" title="框架頁面"></iframe>
</div>
</body>
<script language="javascript" type="text/javascript">
function initIframeHeight() {
try {
var iframe = document.getElementById("ifr_obj");
if (iframe != null) {
if (iframe.contentWindow.document.body != null) {
var bHeight = iframe.contentWindow.document.body.scrollHeight;
var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;
var height = Math.max(bHeight, dHeight);
iframe.height = height;
}
}
}
catch (ex) {
alert("加載框架頁面高度時出錯"+ex.toString());
}
}
window.setInterval("initIframeHeight()", 1000);
</script>
</html>

相關(guān)文章

最新評論