為什么if判斷語句沒進(jìn)去
<!DOCTYPE html>
<html>
?<head>
? <title>瀏覽器對象</title>??
? <meta http-equiv="Content-Type" content="text/html; charset=gkb"/>? ?
?</head>
?<body>
? <!--先編寫好網(wǎng)頁布局-->
? <h5>操作成功</h5><br />
? <p id="txt" style="display:inline;">5</p>秒后回到主頁
? <a>返回</a>
?
? <script type="text/javascript">??
? ?var time=5;
? ?function myTime()
? ?{
? ? ? ?if(time==0)
? ? ? ?{
? ? ? ? ? ?clearInterval(i);
? ? ? ? ? ?window.open("http://www.baidu.com/","_self","");
? ? ? ?}
? ? ? ?document.getElementById("txt").innerHTML=time;
? ? ? ?time--;
? ?}
? ? var i=setInterval(myTime,1000);
? ?//獲取顯示秒數(shù)的元素,通過定時器來更改秒數(shù)。
? ?
? ?//通過window的location和history對象來控制網(wǎng)頁的跳轉(zhuǎn)。
?</script>?
</body>
</html>
2018-11-13
使用世界之窗瀏覽器測試:IE內(nèi)核和Chrome內(nèi)核下,代碼均可正常執(zhí)行。
2018-11-09
使用谷歌瀏覽器的話,你這段是成功執(zhí)行的喲