码迷,mamicode.com
首页 > Web开发 > 详细

HTML页面时间

时间:2014-11-04 16:38:11      阅读:127      评论:0      收藏:0      [点我收藏+]

标签:io   ar   java   sp   div   on   cti   bs   html   

<html>
  <head>
  <meta charset="utf-8">
  <title>无标题文档</title>
  <script type="text/javascript">
  function time(){
  var today=new Date();
  var year=today.getYear()+1900;
  var mounth=today.getMonth()+1;
  var date=today.getDate();
  var weeks=today.getDay();
  var hours=today.getHours();
  var minu=today.getMinutes();
  var ap=hours-12;
  var ss=today.getSeconds();
  date=date<10?"0"+date:date;
  hours=hours>12?(hours-12):hours;
  ap=ap>0?"PM":"AM";
  minu=minu<10?"0"+minu:minu;
  ss=ss<10?"0"+ss:ss;
  var week=Array("周日","周一","周二","周三","周四","周五","周六");
  var timeStr=year+"-"+mounth+"-"+date+" "+hours+":"+minu+":"+ss+" "+ap+" "+week[weeks];
  document.getElementById("timeOut").innerHTML=timeStr;
  }
  window.setInterval("time()",1000);
  </script>
  </head>
   
  <body onLoad="time()">
  <div id="timeOut"></div>
  </body>
  </html>

HTML页面时间

标签:io   ar   java   sp   div   on   cti   bs   html   

原文地址:http://www.cnblogs.com/xiaosen992608/p/4073642.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!