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> |
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。