zoukankan      html  css  js  c++  java
  • 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页面实时显示系统时间,可隐藏。(供参考)

  • 相关阅读:
    用vlc搭建简单流媒体服务器(UDP和TCP方式)
    html5 canvas类库 实例
    html5开放资料
    移动web资源整理
    android设备上运行i-jetty服务
    android上的i-jetty (1)环境搭建
    嵌入式Linux的web视频服务器的构建
    嵌入式web服务器
    视频播放器
    CAE医疗综合视听中心管理系统
  • 原文地址:https://www.cnblogs.com/mauiie/p/3558683.html
Copyright © 2011-2022 走看看