好心人路過看看,真心不知道哪里的問題了
<!DOCTYPE html>
<html>
?<head>
? <title>瀏覽器對象</title> ?
? <meta http-equiv="Content-Type" content="text/html; charset=gkb"/> ??
?</head>
?<body>
? <!--先編寫好網(wǎng)頁布局-->
? <h1>操作成功</h1>
? <b id="count"></b>秒后回到主頁
? <a href="javascript:GoBack()">返回</a>
?
? <script type="text/javascript"> ?
? ??
? ? var num=5;
? ? var i;
? ? function startGo(){
? ? ? ? document.getElementById("count").innerHTML = num;
? ? ? ? num=num-1;
? ? ? ? if(num==0){
? ? ? ? ? ??
? ? ? ? ? ? window.location.assign("http://idcbgp.cn");
? ? ? ? ? ? clearTimeout(i);
? ? ? ? }
? ? ? ? i=setTimeout("start()",1000);
? ? ? ??
? ? }
? ? setTimeout("startGo()",1000);
? ?//獲取顯示秒數(shù)的元素,通過定時器來更改秒數(shù)。
? ? function GoBack(){
? ? ? ? window.history.back();
? ? }
? ?//通過window的location和history對象來控制網(wǎng)頁的跳轉(zhuǎn)。
? ?
?</script>?
</body>
</html>
2016-07-26
? i=setTimeout("start()",1000);中的start()沒有定義