求助,大家可以幫忙看一下嗎?效果就是出不來呀!
<!DOCTYPE html>
<html>
?<head>
? <title>瀏覽器對(duì)象</title>??
? <meta http-equiv="Content-Type" content="text/html; charset=gkb"/>? ?
? <style>
? ? ? a{color:blue;text-decoration:underline;}
? </style>
?</head>
?<body>?
? <!--先編寫好網(wǎng)頁布局-->
??
?<h3>操作成功</h3>
<p><span id="s">5</span>秒后回到主頁 <a herf="javascript:tiaozhuan()">返回</a></p>
? <script type="text/javascript">??
? ?var num=5;
? ?var t= setInterval( function sub(){
? ? ? ? num--;
? ? ? ? document.getElementById("s").innerHTML=num;
? ? ? ? if(num==0){
? ? ? ? ? window.location.href("http://idcbgp.cn");?
? ? ? ? ? clearInterval(t);
? ?}
? ?},1000);
? ?
? ? ? function tiaozhuan(){
? ? ? ?window.location.back();
? ?}
? ? ?}
? ?//獲取顯示秒數(shù)的元素,通過定時(shí)器來更改秒數(shù)。
? ?
? ?//通過window的location和history對(duì)象來控制網(wǎng)頁的跳轉(zhuǎn)。
? ?
?</script>?
</body>
</html>
2019-04-24
把window.location.href("http://idcbgp.cn");
?應(yīng)改為location.href("http://idcbgp.cn");
2019-03-26
把window.location.href改為window.location.assign
2019-02-09
同學(xué)們我的時(shí)間減的又正常了,只是在0秒時(shí)不跳轉(zhuǎn)了
2019-02-09
找到問題了,多了一個(gè)大括號(hào)。然后又又新的問題了,時(shí)間一直在減。。。。