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

我的时间跳的不准啊!求助热心网友!哈哈!

<!DOCTYPE html>

<html>

 <head>

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

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

 </head>

 <body>

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

  <div>

      <h2>操作成功</h2>

     <input type="text" id="txt" style="border:none; width:8px;"/>秒后返回到主页

  </div>

  <script type="text/javascript">

    var num=5;

function numCount(){

document.getElementById('txt').value=num;

num=num-1;

}

setInterval("numCount()",1000);

    function a(){

window.open('http://www.imooc.com','_parent');

}

setInterval("a()",5000);

 </script> 

</body>

</html>


正在回答

代码语言

1 回答

<!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 num=document.getElementById("second").innerHTML;

   //获取显示秒数的元素,通过定时器来更改秒数。

  

    function count()

    {

        num--;

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

        if(num==0)

        {

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

        }

    }

    setInterval("count()",1000);

   //通过window的location和history对象来控制网页的跳转。

    function back()

    {

       window.history.back();

   }

   

 </script> 

</body>

</html>


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

举报

0/150
提交
取消

我的时间跳的不准啊!求助热心网友!哈哈!

我要回答 关注问题
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号