我这个不会自动倒计数,是什么问题 大神求帮个忙啊

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


铃铛3
浏览 1327回答 1
1回答
打开App,查看更多内容
随时随地看视频慕课网APP