Javascript  -  Countdown Script

Countdown Javascript

You can use this for any countdown to a specified date.

  1. Create a Text Box on your page where you want the countdown to appear.
     
  2. Right-click on that Text box and select “Object HTML”
     
  3. In the “Before Tag” field, enter this code:

    <SCRIPT LANGUAGE="JavaScript">
    <!--

    // Copyright (c) 2000 internet.com Corp.
    // http://www.webreference.com/js/
    // License is granted if and only if this entire
    // copyright notice is included. By Tomer Shiran.

    var now = new Date();
    var then = new Date("January 1, 2002");
    var left = then.getTime() - now.getTime();
    var days = Math.floor(left / (1000 * 60 * 60 * 24));
    // var hours = Math.floor(left / (1000 * 60 * 60));// var minutes = Math.floor(left / (1000 * 60));// var seconds = Math.floor(left / 1000);
    if (days > 1)
      document.write("Only " + days + " days left 'till the year 2002!")
    else if (days == 1)
      document.write("Only one day left 'till the year 2002!")
    else if (days == 0)
      document.write("Less than a day left 'till the year 2002!")
    else // days < 0
      document.write("The year 2002 is history!");

    // -->
    </SCRIPT>
    <!--


  4. Click on the “After Tag” tab, and enter this code:

    -->


     
  5. Click on “Ok”

Go Back to Previous Page

Have a question that you can´t find the answer to? Want to report a possible bug?

Send a help request to NetObjects Technical Support