countdown( str element, str date [, int mode [, str name]] )
This function will generate and print the information for your countdown into the
element chosen. It will update every second, formatting it correctly every time.
Date must be a properly formatted string. Examples of valid date string are as follows:
- December 25, 2005 00:00:00 GMT-500
- February 14, 2008 13:44:02 EST
The possible
modes are:
- 0 (default): Time until My Birthday! - 02:33:00 11/21/05: 6 hours, 28 minutes, and 36 seconds.
- 1: My Birthday! - 02:33:00 11/21/05: 6 hours, 28 minutes, and 36 seconds.
- 2: 6 hours, 28 minutes, and 36 seconds.
- 3: 6 hours, 28 minutes, and 36 seconds
Also, in order to load a countdown you must call the function, and then it will update on its own. I reccomend making a function called load() and adding that to the body onload attribute. An example of a load() function is below:
<script language="javascript" type="text/javascript">
function load() {
countdown('time', "September 19, 2006 0:00:00", 2, 'Talk Like a Pirate Day');
countdown('clock', "October 31, 2006 0:00:00", 1, 'Halloween');
}
</script>