水中倒影的时间特效代码 dn001 2009-06-21 08:50:54 <!-- 把如下代码加入<head>区域中 --> <script language="JavaScript"> <!-- //more javascript from http://www.knowsky.com var DifferenceHour = -1 var DifferenceMinute = -1 var DifferenceSecond = -1 var Tday = new Date("Janu 1, 2006 23:59:59") var daysms = 24 * 60 * 60 * 1000 var hoursms = 60 * 60 * 1000 var Secondms = 60 * 1000 var microsecond = 1000 function clock() { var time = new Date() var hour = time.getHours() var minute = time.getMinutes() var second = time.getSeconds() var timevalue = ""+((hour > 12) ? Hour-12:hour) timevalue +=((minute < 10) ? ":0":":")+minute timevalue +=((second < 10) ? ":0":":")+second timevalue +=((hour >12 ) ? " PM":" AM") // document.formnow.now.value = timevalue var convertHour = DifferenceHour var convertMinute = DifferenceMinute var convertSecond = DifferenceSecond var Diffms = Tday.getTime() - time.getTime() DifferenceHour = Math.floor(Diffms / daysms) Diffms -= DifferenceHour * daysms DifferenceMinute = Math.floor(Diffms / hoursms) Diffms -= DifferenceMinute * hoursms DifferenceSecond = Math.floor(Diffms / Secondms) Diffms -= DifferenceSecond * Secondms var dSecs = Math.floor(Diffms / microsecond) if(convertHour != DifferenceHour) document.formnow.dd.value=DifferenceHour if(convertMinute != DifferenceMinute) document.formnow.hh.value=DifferenceMinute if(convertSecond != DifferenceSecond) document.formnow.mm.value=DifferenceSecond document.formnow.ss.value=dSecs // document.formnow.Tnow.value= DifferenceHour DifferenceMinute + DifferenceSecond + dSecs setTimeout("clock()",1000) } // end hiding --> </script> <!-- 修改<body>内容 --> <body onload="clock();return true"> <!-- 把如下代码加入<body>区域中 --> <form name="formnow"> 还剩<input type="text" name="dd" size=2> 天 <input type="text" name="hh" size=2> 小時 <input type="text" name="mm" size=2> 分 <input type="text" name="ss" size=2> 秒就到2006年1月1日 23:59:59啦! </form> 说明:<br/> 各月份中英文对照<br/><br/> 一月 January<br/> 二月 February<br/> 三月 March<br/> 四月 April<br/> 五月 May <br/> 六月 Jun<br/> 七月 July<br/> 八月 August<br/> 九月 September<br/> 十月 October<br/> 十一月 November<br/> 十二月 December