欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

框架頁(yè)面高度自動(dòng)刷新的Javascript腳本

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

<!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>首頁(yè)</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="這里嵌套其它頁(yè)面地址或者文件名" frameborder="0" width="100%" scrolling="no" title="框架頁(yè)面"></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("加載框架頁(yè)面高度時(shí)出錯(cuò)"+ex.toString());
}
}
window.setInterval("initIframeHeight()", 1000);
</script>
</html>

相關(guān)文章

最新評(píng)論