问答详情
源自:8-3 计时器setInterval()

能正确运行,可参考

<!DOCTYPE HTML>

<html>

<head>

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

<title>定时器</title>

<script type="text/javascript">

  var attime;

  function clock(){

    var time=new Date();          

    attime=time.getHours()+":"+time.getMinutes()+":"+time.getSeconds();

    document.getElementById("clock").value = attime;

  }

  setInterval(clock,100);

</script>

</head>

<body>

<form>

<input type="text" id="clock" size="50"  />

</form>

</body>

</html>


提问者:ManLeE 2019-08-26 19:07

个回答

  • 山高丿路远
    2019-09-11 14:03:37

    <body>

    <h1 style="color: aquamarine;">操作成功</h1><br/>

    <span id="djs">3</span>

    <span>秒后返回百度网</span>

    <a href="https://www.baidu.com">手动返回</a><br>

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

    <script type="text/javascript">

    var num=document.getElementById("djs").innerHTML;

    function count()

    {

    num--;

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

    if(num==0)

    {

    location.assign("https://www.baidu.com");

    }

    }

    setInterval("count()",1000);

    function back()

    {

    window.history.back();

    }

    </script>

    </body>