|
作者: asusmlan2 [asusmlan2] 论坛用户 | 登录 |
<form name="form1"> <div align="center" align="middle"> <center>离2010年还有:<br> <input type="textarea" name="left" size="35" style="text-align: center"> </center> </div> </form> <script LANGUAGE="JavaScript"> startclock() var timerID = null; var timerRunning = false; function showtime() { Today = new Date(); var NowHour = Today.getHours(); var NowMinute = Today.getMinutes(); var NowMonth = Today.getMonth(); var NowDate = Today.getDate(); var NowYear = Today.getYear(); var NowSecond = Today.getSeconds(); if (NowYear <2000) NowYear=1900+NowYear; Today = null; Hourleft = 23 - NowHour Minuteleft = 59 - NowMinute Secondleft = 59 - NowSecond Yearleft = 2009 - NowYear Monthleft = 12 - NowMonth - 1 Dateleft = 31 - NowDate if (Secondleft<0) { Secondleft=60+Secondleft; Minuteleft=Minuteleft-1; } if (Minuteleft<0) { Minuteleft=60+Minuteleft; Hourleft=Hourleft-1; } if (Hourleft<0) { Hourleft=24+Hourleft; Dateleft=Dateleft-1; } if (Dateleft<0) { Dateleft=31+Dateleft; Monthleft=Monthleft-1; } if (Monthleft<0) { Monthleft=12+Monthleft; Yearleft=Yearleft-1; } Temp=Yearleft+'年, '+Monthleft+'月, '+Dateleft+'天, '+Hourleft+'小时, '+Minuteleft+'分, '+Secondleft+'秒' document.form1.left.value=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(); } // --> </script></body> ********************************************************* 以上代码,做的比较说,但是不会修改距什么时间,我没法修改,不知道在哪修改,我最好要修改到精确到秒的,说距2006-10-1日6小时21分13秒的,这个是动态的,做的很好, 但最好没有个框框显示出来 就更好了 |
地主 发表时间: 06-10-20 17:29 |
回复: Charlie [charlie] 论坛用户 | 登录 |
Today = null; Hourleft = 23 - NowHour Minuteleft = 59 - NowMinute Secondleft = 59 - NowSecond Yearleft = 2009 - NowYear Monthleft = 12 - NowMonth - 1 Dateleft = 31 - NowDate |
B1层 发表时间: 06-10-20 17:59 |
回复: asusmlan2 [asusmlan2] 论坛用户 | 登录 |
支持,顶 楼主是高手啊!! 能不能再改一改,把人具代码改成从以前到现在计时,就是说是顺时,而不倒计时 |
B2层 发表时间: 06-10-20 18:02 |
回复: asusmlan2 [asusmlan2] 论坛用户 | 登录 |
感谢楼主 现在当不足年,和月时,它会显示为0年,0月。 能不能显示当不足1年和月时,能不能自动隐藏 |
B3层 发表时间: 06-10-20 18:07 |
回复: asusmlan2 [asusmlan2] 论坛用户 | 登录 |
能不能改成正常显示的那个样子,不要搞到框框里显示啊 |
B4层 发表时间: 06-10-20 19:06 |
|
20CN网络安全小组版权所有
Copyright © 2000-2010 20CN Security Group. All Rights Reserved.
论坛程序编写:NetDemon
粤ICP备05087286号