我寫了一個頁面,iframe中,這裏的結構:更改URL時的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>
我設計了一個co在iframe中(page2.html
) ,當時間到了,我想count.html
刷新並更改爲默認頁面index.html
,但是當頁面刷新時,它在count.html
中被刪除並且只刷新了iframe(page2.html
),所以當時間到了,我看到count.html
裏面有一個iframe,裏面有index.html
,怎麼解決?
我沒有看到'countdown.html'隨時隨地 –
@TomSarduy固定它,謝謝 –