zoukankan      html  css  js  c++  java
  • 时间自动在走

     <div style=" 400px;"><span id="clock"  ></span></div>

    <script type="text/javascript">
      window.onload =function() {x=window.setInterval(function(){
              var now = new Date();  //获取 Date对象
              var year = now.getFullYear(); //获取年份
              var month = now.getMonth(); //获取月份
              var day = now.getDate();  //呼气日期
              var weeker = now.getDay() //获取星期
              var hour = now.getHours() //获取小时
              var minu = now.getMinutes();//获取分钟
              var secon = now.getSeconds(); //获取秒
              month = month+1;
              //获取中文星期几
              var arr_week = new Array("星期日","星期一","星期二","星期三","星期四","星期五","星期六");
              var week = arr_week[weeker];
              var time = year+"年"+month+"月"+day+"日"+week+" "+hour+":"+minu+":"+secon;
             ;
              $("#clock").empty();
            $("#clock").append(time);
           },1000);
      }
      </script>

  • 相关阅读:
    结对第一次—原型设计(文献摘要热词统计)
    第一次作业-准备篇
    Alpha冲刺Day9
    Alpha冲刺Day8
    Alpha冲刺Day7
    Alpha冲刺Day6
    Alpha冲刺Day5
    Alpha冲刺Day4
    Alpha冲刺Day3
    Alpha冲刺Day2
  • 原文地址:https://www.cnblogs.com/zhouwen2017/p/9015347.html
Copyright © 2011-2022 走看看