为什么倒计时结束后不能跳转呢,点击“返回”也不能返回前一页?
<!doctype html> <html> <head> <meta charset="utf-8"> <title>制作一个跳转提示页面</title> </head> <body> <p>操作成功</p> <p><span id="txt">5</span>秒后回到主页 <a href="javascript:GoBack()">返回</a></p> <script type="text/javascript"> var num=5; function clock(){ if(num>1){ num=num-1; document.getElementById("txt").innerHTML=num; setTimeout(clock,1000); } else{ location.href("http://www.imooc.com/"); } } setTimeout(clock,1000); function GoBack(){ window.history.back(); } </script> </body> </html>