<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>动态时钟</title>
<script type="text/javascript">
function timer(){
var currentDate=new Date;
var year=currentDate.getFullYear();
var month=currentDate.getMonth()+1;
var day=currentDate.getDate();
var h=currentDate.getHours();
var m=currentDate.getMinutes();
var s=currentDate.getSeconds();
m=checkTime(m);
s=checkTime(s);
document.getElementById('txt').innerHTML=year+"年"+month+"月"+day+"日"+'_'+h+"小时"+m+"分"+s+"秒"+"(中国标准时间)"
t=setTimeout('timer()',1000);
}
function checkTime(i){
if(i<10){
i="0"+i
}
return i
}
</script>
</head>
<body οnlοad="timer();">
<div id="txt"></div>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>动态时钟</title>
<script type="text/javascript">
function timer(){
var currentDate=new Date;
var year=currentDate.getFullYear();
var month=currentDate.getMonth()+1;
var day=currentDate.getDate();
var h=currentDate.getHours();
var m=currentDate.getMinutes();
var s=currentDate.getSeconds();
m=checkTime(m);
s=checkTime(s);
document.getElementById('txt').innerHTML=year+"年"+month+"月"+day+"日"+'_'+h+"小时"+m+"分"+s+"秒"+"(中国标准时间)"
t=setTimeout('timer()',1000);
}
function checkTime(i){
if(i<10){
i="0"+i
}
return i
}
</script>
</head>
<body οnlοad="timer();">
<div id="txt"></div>
</body>
</html>