<div id="curTime"></div>
<script type="text/javascript">
function clock(){
now = new Date();
year = now.getFullYear();
month = now.getMonth() + 1;
day = now.getDate();
today = ['星期日','星期一','星期二','星期三','星期四','星期五','星期六'];
week = today[now.getDay()];
hour = now.getHours();
min = now.getMinutes();
sec = now.getSeconds();
if (hour < 10) {
hour = "0" + hour;
}
if (min < 10) {
min = "0" + min;
}
if (sec < 10) {
sec = "0" + sec;
}
$("#curTime").html(
year + "年" + month + "月" + day + "日" + " " + week + " " + hour + ":" + min + ":" + sec
);
}
setInterval(clock,1000);
</script>
记得引入jquery噢。