终于跑起来了
<!DOCTYPE html> <html> <head> <title>浏览器对象</title> <meta http-equiv="Content-Type" content="text/html; charset=gkb"/> </head> <body> <!--先编写好网页布局--> <h1>操作成功</h1> <h3><span id="con">5</span> <span>秒后回到主页</span><a href=window.history.back()>返回</a></h3> <script type="text/javascript"> var num = 5; function count(){ num--; document.getElementById("con").innerHTML = num; //获取显示秒数的元素,通过定时器来更改秒数。 if(num==1){ window.location.assign("http://www.imooc.com/"); } } setInterval(count,1000); </script> </body> </html>
终于跑起来了