I would like to know about dynamic countdown script.

Asked By 0 points N/A Posted on -
qa-featured

Hello fellows,

I would like to know about dynamic countdown script. I need a timer countdown for a specific website or any Java or visual basic programming language. What would be the easiest way to create a countdown timer using scripts? I need some of your advice; I have to choose first before I begin. This is for our company system; we need a countdown timer for the upcoming events.

Regards,

Isabella Barry.

SHARE
Best Answer by Shifflett Laurel
Answered By 0 points N/A #180045

I would like to know about dynamic countdown script.

qa-featured

Hi,

Here is the code snippet to insert wherever you want:

<Label id="Complete"></label>

02 <Script type="text/JavaScript">

03 var Affiche=document.getElementById("Complete");

04 Function Rebour () {

05 var date1 = new Date();

06 var date2 = new Date ("Fev 1 00:00:00 2013");

07 var sec = (date2 – date1) / 1000;

08 var n = 24 * 3600;

09 If (Sec > 0) {

10 j = Math.floor (sec / n);

11 h = Math.floor ((sec – (j * n)) / 3600);

12 mn = Math.floor ((sec – ((j * n + h * 3600))) / 60);

13 sec = Math.floor (sec – ((j * n + h * 3600 + mn * 60)));

14 Affiche.innerHTML = "Time remaining : " + j +" j "+ h +" h "+ mn +" min "+ sec + " s ";

15 window.status = "Time remaining : " + j +" j "+ h +" h "+ mn +" min "+ sec + " s ";

16 }

17 tRebour=setTimeout ("Rebour();", 1000);

18 }

19 Rebour();

20 </script>

* To select your date, you can simply change concerning "date2": ("Fev 1 00:00:00 2013")

The month is to leave three letters, one is the day of the month (it is useless to put a 0), and 00:00:00 is hours: minutes: seconds.

Of course, the countdown is dynamic and updates itself.

Best Answer
Best Answer
Answered By 0 points N/A #180046

I would like to know about dynamic countdown script.

qa-featured

Hi Barry!

I am giving you a sample code for countdown of anything.

Here The script will count 1 to 100. You can change it as required.

<html>
    <head>
     
       <script type="text/javascript">
       var c=0;
       var t;
      
       var timer_is_on=0;
      
       function timedcount()
       {
         document.getElementById('txt').value=c;
         c=c+1;
         t=setTimeout("timedcount()",100);
       }
      
       function doTimer()
       {
            if(!timer_is_on)
             {
             timer_is_on=1;
              timedcount();
               }
      
       }
       function stopCount()
       {
        clearTimeout(t);
        timer_is_on=0;
       c=0;
       }
      
       
       </script>
    </head>
    
<body>
   
   <input type="button" value="start" onclick="doTimer()"/>
   <input type="button" id ="txt"/>
   <input type="button" value="stop" onclick="stopCount()"/>
   
   
</body>
</html>

This countdown can be stopped and reset. This works well in the Firefox, Opera, GChrome.

Thanking you.

Shifflett Laurel

Related Questions