Added template support... now you can define what the timer says!
The time components are also padded with zero now when less than 10.
Templates take the following placeholders:
{days}
{hours}
{minutes}
{seconds}
Example: '{days} days<br />{hours}:{minutes}:{seconds}'
Fixed end-of-month bug; thanks to Jarin Blackham for catching it for me.
This is a Countdown Timer that can be put anywhere in any web page by simply passing the ElementNode object you need the timer to attach itself to.
This timer is cool because it is fully self-contained, will clear its update interval and remove itself from the document completely the second after its time expires. (Watch the tester)
* If you plan to use multiple timers in your page, make sure to send in unique iCountdownNodeIds.
If you used myTimer as the iCoundownNodeId:
#myTimer{}
#myTimer-title{}
#myTimer-timer{}
In this particular demonstration, I also use my Time Converter JavaScript code to make generating my timer date's easier.
<head> <script type="text/javascript" src="countdown.js"></script> <script type="text/javascript"> function AfterLoad() { CreateCountdown("Time until July 4, 2121", "07-04-2121", document.body, 'myTimer'); } window.onload = AfterLoad; </script> </head>
AddCountdownTester( iNumSeconds );