Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- n<!doctype html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
- <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
- <title>Timery dla uposledzonych</title>
- </head>
- <body>
- <div class="container">
- <div class="row justify-content-center">
- <div class="col-8">
- <h1 class="mt-2">Timery dla uposledzonych</h1>
- <hr class="mt-0 mb-4">
- <p><b>Co:</b> <i id="nazwa1">test3</i> <b>Kiedy:</b> <i id="data1">02/21/2020, 19:09:56</i>
- :::: <font size="3" color="red"> <i id="demo1"></i></font></p>
- <p><b>Co:</b> <i id="nazwa2">test4</i> <b>Kiedy:</b> <i id="data2">02/22/2020, 07:10:19</i>
- :::: <font size="3" color="red"> <i id="demo2"></i></font></p>
- <p><b>Co:</b> <i id="nazwa3">test2</i> <b>Kiedy:</b> <i id="data3">02/22/2020, 21:13:49</i>
- :::: <font size="3" color="red"> <i id="demo3"></i></font></p>
- <p><b>Co:</b> <i id="nazwa4">test1</i> <b>Kiedy:</b> <i id="data4">02/23/2020, 23:11:42</i>
- :::: <font size="3" color="red"> <i id="demo0"></i></font></p>
- <script>
- var elms = document.querySelectorAll("[id='demo']");
- // Update the count down every 1 second
- var x = setInterval(function() {
- // Set the date we're counting down to
- var time = new Array( '02/21/2020, 19:09:56', '02/22/2020, 07:10:19', '02/22/2020, 21:13:49', '02/23/2020, 23:11:42')
- for (var j = 0; j < time.length; j++){
- var countDownDate = new Date(time[j]).getTime();
- // Get today's date and time
- var now = new Date().getTime();
- var distance = countDownDate - now;
- // Find the distance between now and the count down date
- // Display the result in the element with id="demo"
- // document.write("demo" + j)
- // Time calculations for days, hours, minutes and seconds
- var days = Math.floor(distance / (1000 * 60 * 60 * 24));
- var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
- var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
- var seconds = Math.floor((distance % (1000 * 60)) / 1000);
- // Display the result in the element with id="demo"
- document.getElementById("demo" + j).innerHTML = days + "d " + hours + "h "
- + minutes + "m " + seconds + "s ";
- // If the count down is finished, write some text
- if (distance < 0) {
- clearInterval(x);
- document.getElementById("demo" + j).innerHTML = "EXPIRED";
- }
- }
- }, 1000);
- </script>
- <hr class="mt-0 mb-4">
- <input type="submit" value="dodaj timer"
- onclick="window.location='add';" /><br>
- </div>
- </div>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement