JavaScript: A Countdown Timer for Dates

The mighty Shetboy’s heading down under to visit soon, so I thought I’d shove a JavaScript timer in the sidebar… There’s a lot of them out there, but the one I found didn’t work – so I fixed it.

Just shove this somewhere in the body section of a HTML document to see it work…

I’m a bit disappointed that the setInterval call doesn’t work to update the clock ticking down each second… I think it’s something to do with the function scope and references (as discussed here), but I’ve tried wrapping a function around the “proper” function, and calling the proper function from the wrapper, where the wrapper is the one passed to setInterval, but still no dice…

Would be super appreciative if any JavaScript coders out there know how to fix this issue :)

2 thoughts on “JavaScript: A Countdown Timer for Dates”

    1. Hehe – no worries! Time is set for when you arrive here: roughly 11pm Sat 27th of March 2010 – but the time I mean is AU time (GMT+11), so when you run it from the UK it’s going to use your local PC clock on GMT, so it’s counting down to that time in GMT, and therefore will be 11 hours slow!

      Just don’t miss your flight! =P

      P.S. Can’t wait! 4 days and 7 hours till touchdown!

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.