模板无忧
网页特效
每日更新
|
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跳动的时间电子钟
。