• WEB显示(隐藏)系统时间


    <!DOCTYPE html>
    <html>
    <head>
    <title>setinterval.html</title>
    
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="this is my page">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    
    <!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
    
    
    <script type="text/javascript">
        function begintime() {
            timeID = setInterval("getTime()", 1000);
        }
    
        function getTime() {
            var date = new Date();
            var day = date.getDay();
            if (day == 0) {
                day = "";
            }
    
            var Localtime = date.getFullYear() + "" + "  " + date.getMonth()
                    + "" + date.getDate() + "" + "星期   " + day + "   "
                    + date.getHours() + ":" + date.getMinutes() + ":"
                    + date.getSeconds() + "<br>";
            document.getElementById("time").innerHTML = Localtime;
    
            document.getElementById("stoptime").style.display = "block";
            document.getElementById("showTime").style.display = "block";
        }
    
        function stoptime() {
            clearInterval(timeID);
            document.getElementById("stoptime").style.display = "none";
            document.getElementById("showTime").style.display = "none";
        }
    </script>
    </head>
    
    <body>
        This is my HTML page.
        <br>
    
        <br>
        <br>
        <input type="button" value="显示当前时间" onclick="begintime()">
    
        <div style="border: 1px bule thin; 300px;height: 20px;"
            id="showTime">
            <font id="time" color="red"></font>
        </div>
    
        <div style="display:none;" id="stoptime">
            <input type="button" value="停止" onclick="stoptime()">
        </div>
    
    
    </body>
    </html>

      web页面实时显示系统时间,可隐藏。(供参考)

  • 相关阅读:
    【20220502】连岳摘抄
    【20220423】家是孩子最重要的教育场所
    【20220425】连岳摘抄
    【20220430】连岳摘抄
    【20220427】二宝让我们省吃俭用
    【20220503】连岳摘抄
    工作感受月记202205月
    Appium实现百词斩
    Appium自动微信读书打卡
    删除ssh 连接缓存
  • 原文地址:https://www.cnblogs.com/mauiie/p/3558683.html
Copyright © 2020-2023  润新知