www.webdeveloper.com
Results 1 to 3 of 3

Thread: Custom Reset Button For Countdown Timer

  1. #1
    Join Date
    Sep 2009
    Posts
    2

    Custom Reset Button For Countdown Timer

    Here is my countdown timer, from

    http://www.hashemian.com/tools/javascript-countdown.htm
    Code:
    <script language="Javascript">TargetDate="09/04/2010 09:17 AM GMT";BackColor = "transparent";ForeColor = "white";CountActive = true;CountStepper = -1;LeadingZero=true;DisplayFormat="%%H%% Hours, %%M%% Minutes, %%S%% Seconds.";FinishMessage="Spawned";</script><script language="Javascript" src="http://scripts.hashemian.com/js/countdown.js"></script>
    It's very simple and works well for what I need, what I'm now looking for is a reset button to work with this timer. When the reset button is pressed (by anyone) it should reset the "TargetDate" to current date/time (in GMT) then +2 hours, meaning whenever pressed the countdown should start counting down 2 hours. (If this is possible)

    I'm a complete novice at javascript and would appreciate any help you may provide, links, guidance, or code.

    Thanks alot

  2. #2
    Join Date
    Oct 2006
    Posts
    939
    You'll need to use a cookie so that the newly defined var TargetDate is not lost when closing the browser.

    Some functions you might consider using...

    dateObject.getTimezoneOffset()
    Date.parse(datestring)
    dateObject.getTime()

    Of course, I like solving puzzles. If I know what the objective is, I would write my own code. A cursory glance at what the other guy did reveals old code, probly inefficient, I dare to bet I could do better.

  3. #3
    Join Date
    Sep 2009
    Posts
    2
    The timer is for my clan, to time re-spawn times of "boss" monsters. They spawn at fixed time periods. I was originally looking for some sort of "egg timer" or "reverse stopwatch" sort of timer, as opposed to a timer that counts down to a specific date and time, but couldn't find anything close.

    The timer needs to count down in hours, minutes and seconds. A reset button do as specified in the original post, and a stop button which will remove the timer and display a message in it's place.

    Thanks.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles