求幫看看代碼哪里出問題了! ! !
<!DOCTYPE html>
<html>
?<head>
? <title>瀏覽器對象</title> ?
? <meta http-equiv="Content-Type" content="text/html; charset=gkb"/> ??
?</head>
?<body>
? <!--先編寫好網(wǎng)頁布局-->
? <h1>操作成功</h1>
? <p><span id="num">5</span>秒后回到主頁 <input type="Button" id="ru" value="返回" onclick=window.history.back()></p>
??
?
? <script type="text/javascript"> ?
? ?//獲取顯示秒數(shù)的元素,通過定時器來更改秒數(shù)。
? ?var num1=5;
? ?function subs()
? ?{
? ? ? ?document.getElementById("num").innerHTML=num1;
? ? ? ?num1=num1-1;
? ? ? ?setTimeout("subs()",1000);
? ? ? ?if(num1==0)
? ? ? ?{
? ? ? ? ? ?location.assign("http://idcbgp.cn")
? ? ? ?}
? ? }?
? ? ? ?
?
? ?//通過window的location和history對象來控制網(wǎng)頁的跳轉(zhuǎn)。
? ?
? ?
?</script>?
</body>
</html>
2016-03-20
加一句? ?window.onload = subs;???吧,你的subs函數(shù)寫出來之后,沒有被調(diào)用過