為什么修改成windo.open();函數(shù)5秒后不能跳轉(zhuǎn)???
<!DOCTYPE html><br>
<html><br>
?<head><br>
? <title>瀏覽器對象</title> ?<br>
? <meta http-equiv="Content-Type" content="text/html; charset=gkb"/> ? <br>
?</head><br>
?<body><br>
? <!--先編寫好網(wǎng)頁布局--><br>
? <h2>操作成功</h2><br>
? <div><br>
? ? ? <a id="count"></a><br>
? ? ? <a id="badk" href="#" onclick="back()">返回</a><br>
? </div><br>
? <br>
? <script type="text/javascript"> ?<br>
?<br>
? ?//獲取顯示秒數(shù)的元素,通過定時器來更改秒數(shù)。<br>
? ?var ele=document.getElementById("count");<br>
? ?var count=5;<br>
? ?var timer=setInterval(jump,1000);<br>
? ?//通過window的location和history對象來控制網(wǎng)頁的跳轉(zhuǎn)。<br>
? ?function jump()<br>
? ?{<br>
? ? ? ? ele.innerHTML=count+"秒后回到主頁" ;<br>
? ? ? ? count--; ? <br>
? ? ? ? if(count==0)<br>
? ? ? ? {<br>
? ? ? window.location.href = ?"http://idcbgp.cn/";<br>
<br>
? ? ? ? ? ? clearInterval(timer);<br>
? ? ? ? } ? ? ? ?<br>
? ?}<br>
? ?function back(){<br>
? ? ? window.history.back(); ?<br>
? ?}<br>
?</script> <br>
</body><br>
</html><br>
為什么修改成windo.open();函數(shù)5秒后不能跳轉(zhuǎn)???
2016-06-28
window.open 用來打開新窗口?
window.location 用來替換當(dāng)前頁,也就是重新定位當(dāng)前頁?