状态栏时间跳动

- 站长中国 (http://www.zzchina.net)
-- 网页特效 (http://www.zzchina.net/javascript/)
--- 状态栏时间跳动 (http://www.zzchina.net/javascript/1/7.htm)
-- 发布日期: 2004-05-24
<!-- 网页特效代码由[站长中国:http://www.zzChina.net]提供! -->
<!-- 要实现此效果需要 2 个步骤: -->

<!-- 第 1 步: -->
<!-- 把<BODY>中的属性代码改为: -->

<BODY onLoad="updateTime()">



<!-- 第 2 步: -->
<!-- 把下面的代码加到<BODY></BODY>区域中: -->

<SCRIPT LANGUAGE="JavaScript">
<!--
var flasher = false
// calculate current time, determine flasher state,
// and insert time into status bar every second
function updateTime() {
var now = new Date()
var theHour = now.getHours()
var theMin = now.getMinutes()
var theTime = "" + ((theHour > 12) ? theHour - 12 : theHour)
theTime += ((theMin < 10) ? ":0" : ":") + theMin

theTime += ((flasher) ? " " : " =")
theTime += (theHour >= 12) ? " 下午" : " 上午"
flasher = !flasher
window.status = theTime
// recursively call this function every second to keep timer going
timerID = setTimeout("updateTime()",1000)
}
//-->
</SCRIPT>


zzchina.net