Answers for "countdown event javascript"

C#
11

countdown in javascript

<!DOCTYPE html>
<html lang="en">
   <head>
      <meta charset="UTF-8" />
      <title>Countdown timer using HTML and JavaScript</title>
   </head>
   <body>
      Registration closes in <span id="timer">05:00<span> minutes!

      <!-- custom js -->
      <script>
         window.onload = function () {
            var minute = 5;
            var sec = 60;
            setInterval(function () {
               document.getElementById("timer").innerHTML =
                  minute + " : " + sec;
               sec--;
               if (sec == 00) {
                  minute--;
                  sec = 60;
                  if (minute == 0) {
                     minute = 5;
                  }
               }
            }, 1000);
         };
      </script>
   </body>
</html>
Posted by: Guest on March-05-2021
0

countdownevent

class Program
{
    static void Main(string[] args)
    {
        CountdownEvent countObject = new CountdownEvent(10);
        int[] result = new int[10];
 
 
        for (int i = 0; i < 10; ++i)
        {
            int j = i;
            Task.Factory.StartNew(() =>
                {
 
                    Thread.Sleep(TimeSpan.FromSeconds(3));
                    result[j] = j * 10;
 
                    countObject.Signal();
                });
        }
 
        countObject.Wait();
 
        foreach (var r in result)
        {
            Console.WriteLine(r);
        }
             
        Console.ReadLine();
 
        /* Result
            * 0
            * 10
            * 20
            * 30
            * 40
            * 50
            * 60
            * 70
            * 80
            * 90 */
 
    }
}
Posted by: Guest on June-15-2020

Code answers related to "countdown event javascript"

C# Answers by Framework

Browse Popular Code Answers by Language