zoukankan      html  css  js  c++  java
  • html动态显示时间

    注:setInterval和setTimeout的区别

    setInterval是按照设置的时间无限次数的刷新

    setTimeout是按照设置的时间值刷新一次

    所以例二setTimeout实现了递归回调

    <head>
        <title>无标题页</title>

        <script type="text/javascript">
       
       
        function sa()
        {
        var Time=new Date();
        document.getElementById("div").innerHTML=Time.getSeconds();
        }
       window.setInterval("sa()",1000);
        </script>

    </head>
    <body>
        <div id="div">
        </div>
    </body>

    ====================================================================

    或者

    <head>
        <title>无标题页</title>

        <script type="text/javascript">
       
       
        function sa()
        {
        var Time=new Date();
        document.getElementById("div").innerHTML=Time.getSeconds();
        setTimeout("sa()",1000);
        }
       window.setTimeout("sa()",1000);
        </script>

    </head>
    <body>
        <div id="div">
        </div>
    </body>

  • 相关阅读:
    windows10装机小记
    Linus Benedict Torvalds hate FUD
    营销文章good
    商城趣聊4
    商城趣聊3
    商城趣聊2
    商城趣聊1
    temp
    学习代码检视方法 (摘自某图片)
    xilinx sdk闪退问题
  • 原文地址:https://www.cnblogs.com/happygx/p/1958052.html
Copyright © 2011-2022 走看看