![]() |
#1 | ||
Join Date: Oct 2004
Location: Opole, Poland
Posts: 14,276
|
![]() This is the code:
HTML Code:
<title>   </title> <SCRIPT LANGUAGE="JAVASCRIPT"> td = new Date(); BD = new Date("October 1, 2008"); ms = 24 * 60 * 60 * 1000 ; tL = (BD.getTime() - td.getTime()); edL = tL / ms; dL = Math.floor(edL); ehL = (edL - dL)*24; hL = Math.floor(ehL); emL = (ehL - hL)*60; mL = Math.floor(emL); sL = Math.floor ((emL - mL)*60); </script> </head> <BODY BGCOLOR=black TEXT=white> <center> <FONT FACE=Arial,Helvetica SIZE=10> <script language="javascript"> if (self==parent) { document.write('<FONT SIZE=5><i><p>"Gantz."</p> <p>"Katastrophe."</p></i><BR><BR><BR></FONT>') }; document.write("<B>"+dL+" d, "+hL+" hrs, "+mL+" min "+sL+" s</B>"); timerID = setTimeout("location.reload()",1000); timerID = setTimeout("history.go(0)",1000); </script> </FONT> </center> </body> </html> However, instead of doing that, the numbers decrease. Where is the error in the script? |
||
![]() ![]() |
|
![]() |
#2 | ||
Join Date: Oct 2005
Location: Capital Federal, Argentina
Posts: 582
|
![]() Unless I am way too sleep-deprived for rational thinking, I think that I found your problem.
Look at this line: Code:
tL = (BD.getTime() - td.getTime()); Code:
tL = (BD.getTime() - td.getTime()); edL = tL / ms; dL = Math.floor(edL); Then you do: Code:
ehL = (edL - dL)*24; hL = Math.floor(ehL); This also means that the time it says is inaccurate. I would try to fix it doing something like evaluating if tL is negative, change this line: Code:
edL = tL / ms; Code:
edL = Math.abs(tL / ms); Code:
document.write("<B>"+dL+" d, "+hL+" hrs, "+mL+" min "+sL+" s</B>"); Code:
<title>   </title> <SCRIPT LANGUAGE="JAVASCRIPT"> td = new Date(); BD = new Date("October 1, 2008"); ms = 24 * 60 * 60 * 1000 ; tL = (BD.getTime() - td.getTime()); edL = Math.abs(tL / ms); dL = Math.floor(edL); ehL = (edL - dL)*24; hL = Math.floor(ehL); emL = (ehL - hL)*60; mL = Math.floor(emL); sL = Math.floor ((emL - mL)*60); </script> </head> <BODY BGCOLOR=black TEXT=white> <center> <FONT FACE=Arial,Helvetica SIZE=10> <script language="javascript"> if (self==parent) { document.write('<FONT SIZE=5><i><p>"Gantz."</p> <p>"Katastrophe."</p></i><BR><BR><BR></FONT>') }; if (tL < 0) { document.write("<B>-"+dL+" d, "+hL+" hrs, "+mL+" min "+sL+" s</B>"); } else { document.write("<B>"+dL+" d, "+hL+" hrs, "+mL+" min "+sL+" s</B>"); } timerID = setTimeout("location.reload()",1000); timerID = setTimeout("history.go(0)",1000); </script> </FONT> </center> </body> </html> |
||
![]() ![]() |
|
![]() |
#3 | ||
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: May 2005
Location: Nitra, Slovakia
Posts: 6,533
|
![]() holy hell that one looks horrible, why would it refresh the whole page every time?
get another one http://www.google.com/search?ie=UTF-...vascript+timer
__________________
![]() |
||
![]() ![]() |
|
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
OK this is weird... | Mrazerty | Trash Can | 5 | 04-05-2008 02:11 AM |
Javascript And Firefox | Abi79 | Tech Corner | 3 | 09-04-2006 05:53 AM |
Weird Halo Mod | TheGiantMidgit | Blah, blah, blah... | 4 | 01-12-2005 02:38 AM |
This Is Weird I Need Help | malice | Troubleshooting | 4 | 21-11-2005 11:13 PM |
|
|
||
  |