How To Create A countdown

by 32 replies
38
Can someone please show me how to create a simple countdown for one of my landing pages...

What I'm trying to do is make a number like 102.3 (seconds.milliseconds) countdown to zero. I want it to start over for every visitor.

Just looking for regular text.. Nothing fancy..

I've been trying to find this script for a long time now (on and off a year) but can't come across what I need; not even with Google..

If it's some type of secret industry script, please email me about it..

I greatly appreciate it..
#programming #countdown #create #script
  • What you're looking for is a Javascript countdown timer. If you Google it you'll find tons of choices and code examples.

    FYI, a tenth of a second (as in your example) is called a decisecond. A millisecond would be like 102.3000, which would be extremely processor-intensive to count down and would probably crash most (if not all) of your visitor's browsers.

    I would just use seconds if I were you. Any greater resolution than that, and you start risking potential browser/display issues with your visitors who are on slower connections.
    • [ 1 ] Thanks
    • [1] reply
    • Looks like I learnt something new today, its interesting I just learnt the other day that "jiffy" is actually a measurement as well, not just the slang ive always thought it to be.
  • Learn something new everyday. I've done tons of searches but I don't think I searched for that exactly..

    Thanks Brandon..

    I'll get on it...
  • Javascript can do this, it will reset every time a user refreshes the page though
    • [1] reply
    • I'm not sure if it's useful to OP either way, but it doesn't have restart every visit if you know how to use the javascript cookies plugin.
      • [1] reply
  • Hi Dennis,

    have you checked this: jQuery Plugin: jQuery Countdown
    • [ 1 ] Thanks
  • Hello,

    I made a small javascript snippet, that may do what you want... or at least what I understand you want
    However it may "force" the browser a bit, but it should be fine.

    HTML Code:
    <script>
    milliseconds = 200 * 1000;  //countdown length
    
    first = new Date().getTime();     
    function start_cd()
    {
         now = new Date().getTime() - first;
         document.getElementById('timer').innerHTML = Math.round((milliseconds - now)/1000*1000)/1000;
        
         if (milliseconds - now > 0)
                 setTimeout("start_cd()", 1);
    
         
    }
    </script>
    
    <body onLoad="start_cd();">
    <div id="timer">
    </div>
    </body>
    • [ 1 ] Thanks
  • Banned
    In order to create a countdown timer in JavaScript you'll have to use the window.setTimeout function which will call a JavaScript function after a certain amount of time.
  • Javascript count doen is the best solution. you can create very attractive ones.
    • [1] reply
    • Ok.. Sending you a pm and a friend request now.. Thanks

      I guess I need to study JavaScript because I see that it is very valuable to Internet marketing. What's a good way to get started in learning JavaScript if anyone knows any
      • [2] replies
  • Give me your email, then i can email you my wordpress plugin for countdown.
    • [ 1 ] Thanks
  • Easy way to get rid of this **** >> MAKE YOUR OWN COUNTER

    Alternative Solution To This Problem
  • You can either use flash or php to make count down, according to me flash countdown is better
  • I will try with this keyword "Javascript countdown timer", I was also thinking about it.... I might need it if I move my site to another server.
  • To create a countdown on your landing page then you have to do it with javascript and to do that you need to have proper knowledge and skill about programming language.
  • do you familiar with jQuery framework?, if you familiar then PM me (sorry but, I can't sit down everyday in front of my laptop)
  • Banned
    Can you put PHP or java on your site? If you can use java then try that. It should be real easy to make one that is constantly ticking down. Also, you can probably make one in flash. I know for a fact you could do one in PHP but it wouldn't tick down constantly, only when the page was refreshed. Try searching google for a premade one.
  • Are you looking for something like this:

    LaunchSoon Demo
  • Banned
    [DELETED]
  • Here i have shared a link where you can find your solution.
    you can create countdown by using javascript.

    http://www.google.com/url?sa=t&rct=j...hObk6vsTfjky0w
  • Use the following code.

    Code:
    <script language="JavaScript">
    
    //Refresh page script- By Brett Taylor (glutnix@yahoo.com.au)
    //Modified by Dynamic Drive for NS4, NS6+
    //Visit http://www.dynamicdrive.com for this script
    
    //configure refresh interval (in seconds)
    var countDownInterval=60;
    //configure width of displayed text, in px (applicable only in NS4)
    var c_reloadwidth=200
    
    </script>
    
    
    <ilayer id="c_reload" width=&{c_reloadwidth}; ><layer id="c_reload2" width=&{c_reloadwidth}; left=0 top=0></layer></ilayer>
    
    <script>
    
    var countDownTime=countDownInterval+1;
    function countDown(){
    countDownTime--;
    if (countDownTime <=0){
    countDownTime=countDownInterval;
    clearTimeout(counter)
    window.location.reload()
    return
    }
    if (document.all) //if IE 4+
    document.all.countDownText.innerText = countDownTime+" ";
    else if (document.getElementById) //else if NS6+
    document.getElementById("countDownText").innerHTML=countDownTime+" "
    else if (document.layers){ //CHANGE TEXT BELOW TO YOUR OWN
    document.c_reload.document.c_reload2.document.write('Next <a href="javascript:window.location.reload()">refresh</a> in <b id="countDownText">'+countDownTime+' </b> seconds')
    document.c_reload.document.c_reload2.document.close()
    }
    counter=setTimeout("countDown()", 1000);
    }
    
    function startit(){
    if (document.all||document.getElementById) //CHANGE TEXT BELOW TO YOUR OWN
    document.write('Next <a href="javascript:window.location.reload()">refresh</a> in <b id="countDownText">'+countDownTime+' </b> seconds')
    countDown()
    }
    
    if (document.all||document.getElementById)
    startit()
    else
    window.onload=startit
    
    </script>
    • [1] reply
    • Hey Gang - Do you know of a countdown timer solution that will work within a WSO post?
      • [1] reply

Next Topics on Trending Feed

  • 38

    Can someone please show me how to create a simple countdown for one of my landing pages... What I'm trying to do is make a number like 102.3 (seconds.milliseconds) countdown to zero. I want it to start over for every visitor.