Yet another Countdown Timer

You may have seen those timer based on a Flash animation. You have to be familiar with Flash Studio to create your own one.

My son created a simple JavaScript replica of this timer. His Online Countdown Timer became popular because of you can just insert a few lines of code into your html-page to get it working.

How it works

I’ve just copied this code below from his site and pasted into html-source of this page.

<style>
table.timer { font: bold 24pt Tahoma, Arial, Helvetica; color: brown; }
table.timer.td { padding: 0; margin: 0; }
table.timer tr.labels td { font-size: 10pt; }
</style>
<script type='text/javascript'>

var timerEnd = new Date('September 1, 2009,08:00:00');
</script>
<script
src='http://blog.go-test.net/wp-content/uploads/2006/07/timer.js' ></script>

And what I have got:



Share in social bookmarking:These icons link to social bookmarking sites where readers can share and discover new web pages.  digg del.icio.us BlinkList Reddit NewsVine YahooMyWeb co.mments

Related Articles:

2 Responses to “Yet another Countdown Timer”

  1. pk80356 Says:

    Hi Michel,

    This is a great script and I am using it on my own site. It rocks. I was wondering if you know how I can add a line of code that will redirect the user to a new page after the countdown timer reaches 0. Right now, when the countdown reaches 0, the page does not redirect. How can I do that? I really appreciate your help. Thank you in advance.

  2. michel Says:

    Hello Peter,

    1) Download these javascript from
    http://blog.go-test.net/wp-content/uploads/2006/07/timer.js
    to your local PC.

    2) Open the script with a text editor (i.e. Notepad)

    3) Find this code-lines at the top of the file (lines from 8 to 12):
    if (time.getTime() > timerEnd.getTime())
    {
      expired = 1;
    }
    else

    4) Add this code (in red) to redirect them to a new page:
    if (time.getTime() > timerEnd.getTime())
    {
      expired = 1;
      location.assign("http://yoursite.com/new-page.html");
    }
    else

    Hope this helps.

    Michel

Got a question?   Leave a Reply

You must be logged in to post a comment.