<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<div id="div1">
</div>
<script type="text/javascript">
window.οnlοad=function show(){
var date=new Date();
var fullyuar=date.getFullYear();//年
var month=date.getMonth()+1; //月
var mydate=date.getDate(); //日
var h=date.getHours(); //时
var m=date.getMinutes(); //分
var s=date.getSeconds(); //秒
var day=date.getDay(); //星期几
var days=checkday(day);
var ms=checkTime(m);
var sb=checkTime(s);
document.getElementById("div1").innerHTML=(fullyuar+"年"+month+"月"+mydate+"日"+days+" "+h+":"+ms+":"+sb);
var time=setTimeout(show,1000);
}
function checkTime(i){
if (i<10){
i="0" + i;
}
return i;
}
function checkday(i){
switch(i){
case 0:i="星期日";break
case 1:i="星期一";break
case 2:i="星期二";break
case 3:i="星期三";break
case 4:i="星期四";break
case 5:i="星期五";break
case 6:i="星期六";break
}
return i;
}
</script>
</body>
</html>