[javascript]代码库
<html>
<head>
<title>在页面的状态栏动态显示时间</title>
</head>
<body onLoad="showtime();" onUnload="clearTimeout(tID);">
在状态栏上显示了当前时间
<script Language="JavaScript">
var gtime;
function showtime() {
var now = new Date();
var hours = now.getHours(); //取得当前小时、分、秒
var minutes = now.getMinutes();
var seconds = now.getSeconds();
var timeValue = "现在是"+((hours >= 12) ? "下午" : "上午" );
timeValue +=((hours >12) ? hours -12 :hours);
timeValue += "点 " + minutes + "分 " + seconds + "秒";
window.status = timeValue;
gtime = setTimeout("showtime()",1000); //每1000毫秒更新一次
}
</script>
</body>
</html>