在状态栏显示时钟

<html>
<head>
<script>
// 该函数将在状态栏显示时钟
// 一旦调用该函数就会激活时钟,此后它将自己调用自己
function display_time_in_status_line(){
 var d = new Date();
 var h = d.getHours();
 var m = d.getMinutes();
 var ampm = (h >= 12)?"PM":"AM";
 if (h>12) h -= 12;
 if (h == 0) h = 12;
 if (m < 10) m = "0" + m;
 var t= h + ':' + m + ' ' + ampm;
 defaultStatus = t;
 
 setTimeout("display_time_in_status_line()",60000);
}
</script>
</head>
<body onload="display_time_in_status_line();">
</body>
</html>

没有更多推荐了,返回首页