SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Oct 2009
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question a countdown timer

    hi,
    i need a timer that count down the time from 30 to 0 and if the timer is zero the script run php code # 1 ( the timer will stop and if user refreshes the page it is still zero) and if the user hit button # 1 the timer will restart to 30 and the script will run php code # 2 ( the timer will count down again until it is zero). i want the script to work between 1 pm to 3pm(so it starts automatically i at 1)and if the timer didn't get to zero until 3pm i want it to stop counting down and show a message or goes to a different page.
    and obviously the timer should show a same number for all the users!
    is there any way to do that and if yes how?
    can i do it with ajax and if yes how?

    thank you

    farshad

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    It counts from 30 to 0, over a 2 hour period, so the number on screen should change once every 4 minutes?

    And if any user hits a button, it starts over at 30 and you have to recompute the interval it should count down to reach 0 at 3PM again?

    And really "code #1" has nothing to do with this timer, since it only runs at time 0, you could just automatically run it at 3PM?

    I probably don't have this right, but your question is a bit of a mess.

  3. #3
    SitePoint Member
    Join Date
    Oct 2009
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    this is an understand able version of what i just said
    I am making a website and the page is oriented around a countdown system. If the timer ever reaches 0, the whole thing will stop. Below are the specifics:

    I need a countdown timer that runs from 30 seconds to 0 seconds. If the timer is at 0 seconds, the script runs php code #1 (which makes the timer stop and if any user refreshes the page, it will still stay at zero).
    There is also two buttons. If user clicks on button #1, the timer will get reset to 30 seconds remaining. Then the script will run the php code #2 (which allows the timer to begin counting down again from 30 seconds). If user clicks on button #2, the timer will get reset to 5 seconds remaining and same thing follows as the first button.

    I want the timer counter script to between before certain hours (like let's say, noon-4PM). I want the counter to automatically begin at Noon with the above instructions. Also, if by 4PM, the counter never reaches 0 (meaning it never reaches php code #1), I want the timer counter to stop, disappear, and a message appear over it to link it to a new page.

    And obviously the timer should show the same number (seconds remaining) for all the users on the website!


Bookmarks

Posting Permissions

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