显示动态时间
<html>
<head><script type="text/javascript">
function startTime()
{
var today=new Date() //获取当前时间
var h=today.getHours() //获取小时
var m=today.getMinutes() //获取分钟
var s=today.getSeconds() // 获取秒钟
// add a zero in front of numbers<10
m=checkTime(m)
s=checkTime(s)
document.getElementById('txt').innerHTML=h+":"+m+":"+s
t=setTimeout('startTime()',500) //刷新}
function checkTime(i)
{
if (i<10)
{i="0" + i}
return i
}
</script>
</head>
<body onload="startTime()">
<div id="txt"></div>
</body>
</html>