1. Computing & Technology

Countdown Timer

2. The Timer Script

clr gif
Join the Discussion

Questions? Comments?

More of this Feature

Introduction

To add the countdown script to your web page you first need to select the code from the text box below (there is a highlight all button beneath it to make this easier) and copy it into a file called count.js.

Amend the values for month, day, hour, and tz to reflect the date/time at your location to which you want the countdown timer to count down.

You next link it into the bottom of the body of your page using the following code (immediately before the </body> tag):

<script type="text/javascript" src="count.js">
</script>

The final step is to add the following code into the body of your web page where you want the countdown to be displayed:

<span id="cd"></span>

If you need to change the id associated with the countdown timer simply change the value from cd to your required value in both the span tag and the lab variable at the top of the script. You can also copy the marked section at the top of the script and set different values in order to put another countdown timer into a different span in your page (and so on if you want more than two countdowns).

©2012 About.com. All rights reserved.

A part of The New York Times Company.