模板無憂
網頁特效
每日更新
|
TOP排行榜
|
Tag標簽
|
充值
無憂首頁
網頁模板
程序模板
建站教程
視頻教程
網頁特效
圖標素材
字體下載
站長工具
站長問答
網頁特效
菜單導航
圖片特效
文本鏈接
層和布局
頁面背景
表單按鈕
日期時間
計算轉換
鍵盤鼠標
瀏覽器
游戲娛樂
綜合其它
常用代碼
jQuery特效
Prototype
Ajax/JavaScript
ExtJS
CSS特效
在線編輯器
Mootools
HTML
JS廣告代碼合集
站長工具
站長常用軟件
網站綜合查詢
Alexa排名查詢
Google PR查詢
域名Whois查詢
網站收錄查詢
友情鏈接查詢
CSS2中文手冊
CSS精簡優化工具
網頁特效代碼
模板無憂
>
網頁特效
>
日期時間特效代碼
>
收藏
分享
查看評論
日期時間
演示
JavaScript跳動的時間電子鐘_日期時間特效
查看演示效果
特效Tag:
電子鐘
添加
JavaScript跳動的時間電子鐘,無不刷新頁面實現的液晶電子鐘,個人感覺還行。
腳本說明: 第一步:如下代碼加入<head>中: <script language="JavaScript"> <!-- Hide this script from old browsers -- function modRange (value, min, max) { if (min == max) { return (min) } var low = Math.min (min, max) var high = Math.max (min, max) var range = high - low + 1 var valOff = parseInt (value) - low var mod = range * Math.floor (valOff / range) result = low + valOff - mod if (result < low) { result += high } if (result > high) { result = low } return (result) } function array () { this[0] = null } function timerAppStart () { this.stop () this.loop () } function timerAppStop () { clearTimeout (this.timeout) this.timeout = null } function timerAppToggle () { if (this.timeout) { this.stop () } else { this.start () } } function timerAppLoop () { this.update () command = this.name + '.loop()' for (var i = 0; i < this.syncCount; i++) { if (this.syncName[i] != '') { if (--this.syncCountdown[i] <= 0) { this.syncCountdown[i] = this.syncInterval[i] command += ';' + this.syncName[i] + '.update()' } } } this.timeout = setTimeout (command, this.interval) } function timerAppSetOutput (output) { if (! this.output) { this.output = output } } function timerAppSetInterval (interval) { if (interval) { var newInterval = parseInt (interval) if (newInterval > 0) { this.interval = newInterval } else { alert ('Interval value must be a positive number: ' + interval) } } } function timerAppSync (name, interval) { if (interval == null) { interval = 1 } if (interval <= 0) { eval (this.name + '.unsync("' + name + '")') return } var newIndex = this.syncCount for (var i = 0; i < this.syncCount; i++) { if (this.syncName[i] == name) { newIndex = i break } } if (newIndex == this.syncCount) { this.syncCount++ } this.syncInterval[newIndex] = interval this.syncCountdown[newIndex] = interval this.syncName[newIndex] = name } function timerAppUnsync (name) { for (var i = 0; i < this.syncCount; i++) { if (this.syncName[i] == name) { this.syncName[i] = '' if (i == (this.syncCount - 1)) { this.syncCount-- } } } } function timerAppSetIncrement (increment) { if (increment) { var newIncrement = parseInt (increment) //*Unix only* if (! isNan (newIncrement)) { if (newIncrement != 0) { this.increment = newIncrement } else { alert ('Increment value must be a number: ' + increment) } } } function timerAppSetBounce (bounce) { if (bounce) { var newBounce = parseInt (bounce) //*Unix only* if (! isNan (newBounce)) { if (newBounce != 0) { this.bounce = newBounce } else { alert ('Bounce value must be a number: ' + bounce) } } } function timerAppSetOffset (offset) { if (offset) { var newOffset = parseInt (offset) if ((newOffset > 0) && (newOffset <= this.output.length)) { this.offset = newOffset } else { warnMessage = 'Value of offset must be a valid index (0 - ' + this.output.length + '): ' + offset alert (warnMessage) } } } function clock (name, output, interval) { // Initialize with default values this.name = name // object name, needed for setTimeout this.output = null // output area this.interval = 1000 // milliseconds this.timeout = null this.syncCount = 0 this.syncName = new array () this.syncInterval = new array () this.syncCountdown = new array () // Define object methods this.update = clockUpdate this.start = timerAppStart this.stop = timerAppStop this.toggle = timerAppToggle this.loop = timerAppLoop this.setOutput = timerAppSetOutput this.setInterval = timerAppSetInterval this.sync = timerAppSync this.unsync = timerAppUnsync // Initialize with specified values this.setOutput (output) this.setInterval (interval) this.start() } function clockUpdate () { var now = new Date() var timeHH = now.getHours(); var timeMM = now.getMinutes() var timeSS = now.getSeconds() var msec = now.getTime () var timeSSm = msec - 1000 * Math.floor (msec / 1000) timeSSm = '00' + timeSSm timeSSm = timeSSm.substring(timeSSm.length-3, timeSSm.length) var timeString = ((timeHH < 10) ? '0' : '') + timeHH + ':' + ((timeMM < 10) ? '0' : '') + timeMM + ':' + ((timeSS < 10) ? '0' : '') + timeSS + '.' + timeSSm if (this.output) { this.output.value = timeString } else { self.status = timeString } } function buttons (name, output, interval, increment, bounce, offset) { // Initialize with default values this.name = name this.output = null this.interval = 1000 this.increment = 1 this.bounce = 1 this.offset = 0 this.timeout = null this.syncCount = 0 this.syncName = new array () this.syncInterval = new array () this.syncCountdown = new array () // Define object methods this.update = buttonsUpdate this.start = timerAppStart this.stop = timerAppStop this.toggle = timerAppToggle this.loop = timerAppLoop this.setOutput = timerAppSetOutput this.setInterval = timerAppSetInterval this.sync = timerAppSync this.unsync = timerAppUnsync this.setIncrement = timerAppSetIncrement this.setBounce = timerAppSetBounce this.setOffset = timerAppSetOffset // Initialize with specified values this.setOutput (output) this.setInterval (interval) this.setIncrement (increment) this.setBounce (bounce) this.setOffset (offset) this.start() } function buttonsUpdate () { if (this.output) { var newOffset = this.offset + this.increment if ((newOffset < this.output.length) && (newOffset >= 0)) { this.offset = newOffset } else { this.increment *= this.bounce if (this.increment >= 0) { this.increment = modRange (this.increment, 0, this.output.length-1) } else { this.increment = 0 - modRange (Math.abs (this.increment), 0, this.output.length-1) } this.offset += this.increment this.offset = modRange (this.offset, 0, this.output.length-1) } this.output[this.offset].checked = true } } // -- End Hiding Here --> </script> 第二步:如下代碼加入<body>中: <FORM NAME='clock' ACTION=''> <TABLE BORDER=2><TR><TD> <FONT SIZE=-2> <INPUT TYPE='text' NAME='display' SIZE=8 onFocus='wClock.toggle()' onMouseOver='self.status="Click here to turn on/off clock"; return true'> </FONT> </TD></TR></TABLE> </FORM> <FORM NAME='imastudios'> <INPUT TYPE='radio' NAME='buttons'> Tick <INPUT TYPE='radio' NAME='buttons'> Tock <INPUT TYPE='radio' NAME='buttons'> Tick <INPUT TYPE='radio' NAME='buttons'> Tock <INPUT TYPE='radio' NAME='buttons'> Tick </FORM> 第三步:<body>中內容改為: <body bgcolor="#fef4d9" onLoad='wClock = new clock ("wClock", document.clock.display); wButtons = new buttons ("wButtons", document.imastudios.buttons, 500, 1,-1); wButtons.stop(); wClock.sync ("wButtons", 1)'onUnload='wClock.stop(); wButtons.stop()' bgcolor="#FFFFFF">
所屬頻道:
日期時間特效
/
更新時間:2013-01-15
[收藏]
[報錯]
[返回列表]
相關
日期時間特效
:
一款漂亮的日歷腳本
柱狀時鐘
計算圓周率
隨機數據顯示功能、選號器
層時鐘
跟隨時鐘
在線日歷
一個倒記時
顯示登陸時間
知道兩點的坐標計算機出他們之間的距離
跟隨鼠標的時鐘
日期時間信息 Script
日期時間特效Rss訂閱
特效代碼搜索
日期時間特效推薦
網頁上適時顯示的時間
顯示特殊節日腳本(做一個朋友生日記事可最好不過)
超酷兩百年日歷
選擇日期
背景時鐘
一句話在你的網頁加入JS日期顯示
語言時鐘
用按鈕來控制數字的升降
八種風格的時間日期
超漂亮的JS日歷控件
猜你也喜歡看這些
用Js根據胸圍計算你的文胸尺碼
JavaScript生成隨機整數的代碼
JavaScript根據數據生成百分比圖和柱狀圖
一個簡單的JS加密函數
用JavaScript計算二次函數的根值
手機號碼抽獎程序
JavaScript在線考試系統
HTML轉換為JS代碼
32位JavaScript版MD5加密函數
JS+VML生成圓形百分比餅圖
相關鏈接:
復制本頁鏈接
|
搜索JavaScript跳動的時間電子鐘
特效說明:
日期時間模板
-
JavaScript跳動的時間電子鐘
。