Bookmark to del.icio.us
FF1+ IE5+ Opr7+
Dynamic Countdown Script
Updated: April 24th, 06'. Script completely rewritten.
Dynamic Countdown script belongs to the first type of count down script that lets you count down to relative events of a future date/time. This future date, while the same for everyone, occurs differently depending on the time zone they're in (ie: Christmas, your mom's birthday, April 1st 2015 etc). This script is extremely flexible- you can customize exactly how to display the output, or even specify a custom action to perform at the end of the countdown (ie: go to another page), by passing in your own custom format function.
Step 1: Insert the below script into the HEAD section of your page:
Step 2: Insert the below example script into the BDOY section of your page where you wish the countdown to be shown:
The code of Step 2 shows how to invoke the script to display a countdown on your page, by calling the function cdtime():
new cdtime("ID_of_DIV_container", "target_date")
But wait, to actually display the count down, you must then follow up by calling cdtime().displaycountdown(). Here's an explanation of this method:
Q) How do I customize the output or even behaviour of the countdown?
Answer: The script lets you pass in your own format function as the second parameter of cdtime.displaycountdown(). This enables you great flexibility as far as how to customize the script output. Inside the code of Step 1 above, we've included two sample format functions. Lets take a look at the 2nd one, which displays the nice LCD countdown you see in demo #2:
/////CUSTOM FORMAT OUTPUT FUNCTIONS