為什么我的倒計(jì)時(shí)不動(dòng)呢
<!DOCTYPE html>
<html>
?<head>
? <title>瀏覽器對(duì)象</title> ?
? <meta http-equiv="Content-Type" content="text/html; charset=gkb"/> ??
?</head>
?<body>
? <!--先編寫好網(wǎng)頁(yè)布局-->
? <h1>操作成功</h1>
? <span id="second">5</span>
? <span>秒后回到主頁(yè)</span>
? <a href="window.history.back">返回</a>
?
? <script type="text/javascript"> ?
??
? ?//獲取顯示秒數(shù)的元素,通過定時(shí)器來更改秒數(shù)。
? ?var i=document.getElementById("second").innerHTML;
? ?function tim(){
? ? ? ?i--;
? ? ? ?document.getElementById("second").innerHHTML=i;
? ? ? ?if(i==0){
? ? ? ? ? ?window.location.href="http://idcbgp.cn/";
? ? ? ? ? ?
? ? ? ?}
? ?}
? ?setInterval("tim()",1000);
? ?//通過window的location和history對(duì)象來控制網(wǎng)頁(yè)的跳轉(zhuǎn)。
? ?
??
?</script>?
</body>
</html>
2016-11-15
innerHTML寫成了innerHHTML
2016-11-15
我終于知道你的代碼是什么問題了,你把innerHTML寫成了innerHHTML,所有不行,望采納。