代码:
-
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
</head>
<body>
<div id="time_bar"></div>
<script type="text/javascript">
var od = function(){};
od.prototype.oc = new Array('日','一','二','三','四','五','六');
od.prototype.w = function (b){
return this.oc[b];
}
od.prototype.h = function(t){
if(t<10)return '0'+t;
return t;
}
var d = new od();
var r = function run (){
var now =new Date().getFullYear()+'年' +
(new Date().getMonth()+1)+'月' +
new Date().getDate()+'日'+' ' +
'星期'+d.w(new Date().getDay())+' '+
d.h(new Date().getHours())+':'+
d.h(new Date().getMinutes())+':'+
d.h(new Date().getSeconds());
document.getElementById("time_bar").innerHTML = now;
}
r();
setInterval(r,1000) ;
</script>
</body>
</html>
-