1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Coundown timers

Discussion in 'JavaScript' started by kadi, Aug 6, 2013.

  1. #1
    how can i add a coundown timer of say 30 sec . since i am using a coundown timer which is not working as i require. i got two pages and when i run the code, the timer already started and running in background on page 1 and in page 2 there is no countdown timer showing. i dont know how to achieve my task of showing countdown timers like a game timer for my 2 pages...
    kadi, Aug 6, 2013 IP
  2. hdewantara

    hdewantara Active Member

    Likes Received:
    Best Answers:
    Trophy Points:
    Untested, but is it something like this one?
      counter = 30;
      counterID = setInterval( function(){
        if (counter >0){
          //do something here
      }, 1000);
    hdewantara, Aug 6, 2013 IP
  3. juggalox

    juggalox Member

    Likes Received:
    Best Answers:
    Trophy Points:
    You need to really be more clear in what you post. It's vague but from what I understand , you are trying to retain the countdown timer value from page1 into page2?
    That means you need some sort of communication between the 2 pages. If it's a parent-pop down system , then it's not that difficult.

    You could also use window object , but it's an unsecure way. You can accomplish this by using some server side scripting , say PHP , by doing a polling ajax request in javascript , but that might causelag. The new HTML5 api provides a method but not all browsers support it. Last , you can use cookies which is the old fashioned way.

    Take a look at this , it might help :
    juggalox, Aug 9, 2013 IP