zoukankan      html  css  js  c++  java
  • 在HTML页面获取当前系统时间

    <script language="javascript">
    function getCurDate()
    {
    var d = new Date();
    var week;
    switch (d.getDay()){
    case 1: week="星期一"; break;
    case 2: week="星期二"; break;
    case 3: week="星期三"; break;
    case 4: week="星期四"; break;
    case 5: week="星期五"; break;
    case 6: week="星期六"; break;
    default: week="星期天";
    }
    var years = d.getFullYear();
    var month = add_zero(d.getMonth()+1);
    var days = add_zero(d.getDate());
    var hours = add_zero(d.getHours());
    var minutes = add_zero(d.getMinutes());
    var seconds=add_zero(d.getSeconds());
    var ndate = years+"年"+month+"月"+days+"日 "+hours+":"+minutes+":"+seconds+" "+week;
    var divT=document.getElementById("logInfo");
    divT.innerHTML= ndate;
    }
    function add_zero(temp)
    {
    if(temp<10) return "0"+temp;
    else return temp;
    }
    setInterval("getCurDate()",100);
    </script>

    <p id="logInfo"></p>

  • 相关阅读:
    01背包
    manacher马拉车算法
    盒子放球的DP
    Children’s Queue
    抽象类_作为接口
    斯特林数
    欧拉路HDU3018
    2019 SDN上机第三次作业
    第05组 Alpha冲刺(2/4)
    Alpha冲刺(1/4)
  • 原文地址:https://www.cnblogs.com/21heshang/p/5687570.html
Copyright © 2011-2022 走看看