为了账号安全,请及时绑定邮箱和手机立即绑定

为啥不跳转,眼都花了。。。

<!DOCTYPE html>

<html>

 <head>

  <title>浏览器对象</title>  

  <meta http-equiv="Content-Type" content="text/html; charset=gkb"/>   

 </head>

 <body>

  <!--先编写好网页布局-->

  <h1>操作成功</h1>

<span id="second" >5</span>

  <span >秒后回到主页</span>

  <a href="javascript:back();">返回</a>

  

  

 

  <script type="text/javascript">  

    var n=document.getElementById("second").innerHTML;

    function count();

    {

      n--;

      document.getElementById("second").innerHTML=n;

      if(n==0)

      {

          location.assign("www.imooc.com");

      }

    } 

    setInterval("count()",1000);

     /*function count()

    {

        num--;

        document.getElementById("second").innerHTML=num;

        if(num==0)

        {

            location.assign("www.imooc.com");

        }

    }

    setInterval("count()",1000);*/

 </script> 

</body>

</html>


正在回答

3 回答

function count();后面的分号去掉

0 回复 有任何疑惑可以回复我~

function count();

把这个分号去掉。。。

1 回复 有任何疑惑可以回复我~

function count()

你括号后面加分号了


0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
JavaScript进阶篇
  • 参与学习       468295    人
  • 解答问题       21893    个

本课程从如何插入JS代码开始,带您进入网页动态交互世界

进入课程

为啥不跳转,眼都花了。。。

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信