求助!改了很多遍還是停在5秒不動!
<!DOCTYPE html>
<html>
?<head>
? <title>瀏覽器對象</title> ?
? <meta http-equiv="Content-Type" content="text/html; charset=gkb"/> ??
?</head>
?<body>
? <!--先編寫好網頁布局-->
? <h1>操作成功</h1>
? ?<p><span id="taste"></span>
? 秒后回到主頁
? <a href="javascript:turn()">返回</a></p>
? <script type="text/javascript"> ?
?var num=5;
? ?fuction nameClock()
? ?{
? ? ? ?document.getElementById("taste").innerHTML=num;
? ? ? ?num=num-1;
? ? ? ?if (num==0)
? ? {
? ? ? ? ? ?widow.location.href="http://idcbgp.cn";
? ? ? ? ?}
? ?}
?setInterval("nameClock()",1000);
??
? ?
? ?//獲取顯示秒數的元素,通過定時器來更改秒數。
? ?funtion turn(){
? ? ? ?window.history.go(-1)
? ?}//通過window的location和history對象來控制網頁的跳轉。
? ?
?</script>?
</body>
2016-12-13
??widow.location.href="http://idcbgp.cn";? ? //window打錯了,其實這個window可以不打的
location.assign("網址")//改成這個試試,加載新的文檔
2016-12-13
num-1后要重新賦值給?document.getElementById("taste").innerHTML的吧
2016-12-13
謝謝!
2016-12-13
我看了很久,發(fā)現(xiàn)你的function寫錯了,而且你的5應該寫在html里面,而不是在js里面申明