|
作者: asusmlan2 [asusmlan2] 论坛用户 | 登录 |
这把下的JS代码改成倒计时能精确到秒的,是动态闪动的。 ********************************************************************** < script language="JavaScript" > var urodz= new Date("5/1/2002"); var s="今天离五一劳动节"; var now = new Date(); var ile = urodz.getTime() - now.getTime(); var dni = Math.floor(ile / (1000 * 60 * 60 * 24)); if (dni > 1) document.write(""+s+"还有"+dni +"天") else if (dni == 1) document.write("只有2天啦!") else if (dni == 0) document.write("只有1天啦!") else document.write("好象已经过了哦!"); < /script > 如不会可以参考以下代码: ********************************************************************** var startTime = (new Date()).getTime(); var Temp; var timerID = null; var timerRunning = false; function showtime() { now = new Date(); var ts; if (opMode!=0) { ts=parseInt((startTime-now.getTime())/1000)+auctionDate; } else { ts=auctionDate-parseInt((startTime-now.getTime())/1000); } var dateLeft = 0; var hourLeft = 0; var minuteLeft = 0; var secondLeft = 0; if(ts < 0) { ts = 0; CurHour = 0; CurMinute = 0; CurSecond = 0; } else { dateLeft =parseInt(ts/86400); ts = ts - dateLeft * 86400; hourLeft = parseInt(ts/3600); ts = ts - hourLeft * 3600; minuteLeft = parseInt(ts/60); secondLeft = ts - minuteLeft * 60; } if(hourLeft < 10) hourLeft = '0' +hourLeft; if(minuteLeft < 10) minuteLeft = '0' +minuteLeft; if(secondLeft<10) secondLeft='0'+secondLeft; if( dateLeft > 0 ) dateLeft = dateLeft + "天" ; else dateLeft = ""; if( hourLeft > 0 ) hourLeft = hourLeft + "小时" ; else { if( dateLeft != "" ) hourLeft = "00小时"; else hourLeft = ""; } if( minuteLeft > 0 ) minuteLeft = minuteLeft + "分钟" ; else { if( dateLeft !="" || hourLeft != "") minuteLeft = "00分钟"; else minuteLeft = ""; } if( secondLeft > 0 ) secondLeft = secondLeft + "秒" ; else { if( dateLeft !="" || hourLeft != "" || minuteLeft != "") secondLeft = "00秒"; else secondLeft = ""; } Temp=dateLeft+hourLeft+minuteLeft+secondLeft ; if(auctionDate <= 0 || dateLeft <=0 && hourLeft<=0 && minuteLeft<=0 && secondLeft <=0) { if (opMode!=0) { Temp = "已经到达截止时间!"; }else{ Temp = "历史时间非真正历史时间!"; } stopclock(); } for (var iii = 0; iii < showTime.length; ++iii) { var showTimeItem = showTime[iii]; if (document.getElementById(showTimeItem)) document.getElementById(showTimeItem).innerHTML=Temp; } timerID = setTimeout("showtime()",1000); timerRunning = true; } var timerID = null; var timerRunning = false; function stopclock() { if(timerRunning) clearTimeout(timerID); timerRunning = false; } function startclock() { stopclock(); showtime(); } try { onload=startclock(); } catch(e) { } ***************************************************************** 考验你的时候到了!!! [此贴被 中国黑客(asusmlan2) 在 10月18日19时03分 编辑过] |
地主 发表时间: 06-10-18 19:02 |
回复: asusmlan2 [asusmlan2] 论坛用户 | 登录 |
期待中…… |
B1层 发表时间: 06-10-18 19:21 |
回复: poemail [poemail] 论坛用户 | 登录 |
有空帮你看,等整版变成我的名字先………… |
B2层 发表时间: 06-10-20 15:21 |
回复: asusmlan2 [asusmlan2] 论坛用户 | 登录 |
整版已经成为你的啦~~~~~~~~~~~~~~~快来看看啊 |
B3层 发表时间: 06-10-20 19:37 |
|
20CN网络安全小组版权所有
Copyright © 2000-2010 20CN Security Group. All Rights Reserved.
论坛程序编写:NetDemon
粤ICP备05087286号