<script>
function showTime(){
nowtime=new Date();
year=nowtime.getFullYear();
month=nowtime.getMonth()+1;
date=nowtime.getDate();
hour=nowtime.getHours();
minite=nowtime.getMinutes();
second=nowtime.getSeconds();
document.getElementById("time_h1").innerText=year+"年"+month+"月"+date+"日"+hour+"时"+minite+"分"+second+"秒";
}
setInterval("showTime()",1000);
</script>
下面写一个id为timeShow的div就可以了 显示为XXXX年XX月XX日XX时XX分XX秒