【发布时间】:2015-09-15 03:42:43
【问题描述】:
我写了一个页面,里面有 iframe,结构如下:
count.html:
/* http://example.com/count.html */
<div class="primary">
<h2>Countdown</h2>
<div class="content">
<iframe src="page2.html" id="iframe"></iframe>
</div>
</div>
index.html:
/* http://example.com/index.html */
<div class="primary">
<h2>Home</h2>
<div class="content">
<iframe src="home.html" id="iframe"></iframe>
</div>
</div>
page2.html:
<head>
<script>
var count = "<!--# echo time -->"; /* C code will control it*/
function display() {
if (wait_seconds == null) {
wait_seconds = (count == "" ? 180 : parseInt(count));
}
document.countdown.b.value = wait_seconds;
if (wait_seconds <= 0) {
if(redirect == null || redirect == "")
redirect = "index.html";
location.href = redirect;
return;
} else {
wait_seconds = wait_seconds-1;
}
window.setTimeout("display()", 1000);
}
</script>
</head>
<body>
<form name='countdown'>
<h2>Countdown Bar</h2>
<input type='text' size='2' name='b' disabled>
</form>
<script>
display();
</script>
</body>
我在 iframe 中设计了一个倒计时栏(page2.html)
,时间到了,我想count.html刷新并更改到默认页面index.html,但是当页面刷新时,它卡在count.html并且只刷新iframe(page2.html),所以当时间到了,我看到了count.html有一个iframe,里面有index.html,怎么解决?
【问题讨论】:
-
我在任何地方都没有看到
countdown.html -
@TomSarduy 已修复,谢谢
标签: javascript iframe page-refresh