當前位置:開發者網絡 >> 網頁特效 >> 日期時間 >> 內容
精彩推薦
分類最新特效
分類熱點特效
   
狀態欄時間跳動
日期:2004-05-24   人氣:   【字體: 】【收藏此文


<!-- 網頁特效代碼由[中國WEB開發者網絡:http://www.ChinaWebDev.com]提供! -->
<!-- 要實現此效果需要 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>