<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<div id="box"></div>
<script>
window.onload = function(){
var box = document.getElementById("box");
function time(){
var d = new Date();
box.innerHTML = d.getFullYear()+"年"
+format(d.getMonth()+1)+"月"
+format(d.getDate())+"日 "
+fomatWeek(d.getDay())+" "
+format(d.getHours())+":"
+format(d.getMinutes())+":"
+format(d.getSeconds());
}
function format(t){
return t<10?('0'+t):(''+t);
}
function fomatWeek(v){
return ['星期日','星期一','星期二','星期三','星期四','星期五','星期六'][v];
}
setInterval(time,1000);
}
</script>
</body>
</html>