Advertisement
Guest User

Untitled

a guest
Feb 21st, 2020
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.00 KB | None | 0 0
  1. n<!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  6. <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
  7. <title>Timery dla uposledzonych</title>
  8. </head>
  9. <body>
  10. <div class="container">
  11. <div class="row justify-content-center">
  12. <div class="col-8">
  13. <h1 class="mt-2">Timery dla uposledzonych</h1>
  14. <hr class="mt-0 mb-4">
  15. <p><b>Co:</b> <i id="nazwa1">test3</i> <b>Kiedy:</b> <i id="data1">02/21/2020, 19:09:56</i>
  16. :::: <font size="3" color="red"> <i id="demo1"></i></font></p>
  17.  
  18. <p><b>Co:</b> <i id="nazwa2">test4</i> <b>Kiedy:</b> <i id="data2">02/22/2020, 07:10:19</i>
  19. :::: <font size="3" color="red"> <i id="demo2"></i></font></p>
  20.  
  21. <p><b>Co:</b> <i id="nazwa3">test2</i> <b>Kiedy:</b> <i id="data3">02/22/2020, 21:13:49</i>
  22. :::: <font size="3" color="red"> <i id="demo3"></i></font></p>
  23.  
  24. <p><b>Co:</b> <i id="nazwa4">test1</i> <b>Kiedy:</b> <i id="data4">02/23/2020, 23:11:42</i>
  25. :::: <font size="3" color="red"> <i id="demo0"></i></font></p>
  26.  
  27.  
  28. <script>
  29.  
  30. var elms = document.querySelectorAll("[id='demo']");
  31.  
  32. // Update the count down every 1 second
  33. var x = setInterval(function() {
  34.  
  35. // Set the date we're counting down to
  36. 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')
  37. for (var j = 0; j < time.length; j++){
  38. var countDownDate = new Date(time[j]).getTime();
  39.  
  40. // Get today's date and time
  41. var now = new Date().getTime();
  42.  
  43. var distance = countDownDate - now;
  44. // Find the distance between now and the count down date
  45.  
  46. // Display the result in the element with id="demo"
  47.  
  48. // document.write("demo" + j)
  49.  
  50. // Time calculations for days, hours, minutes and seconds
  51. var days = Math.floor(distance / (1000 * 60 * 60 * 24));
  52. var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
  53. var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
  54. var seconds = Math.floor((distance % (1000 * 60)) / 1000);
  55. // Display the result in the element with id="demo"
  56. document.getElementById("demo" + j).innerHTML = days + "d " + hours + "h "
  57. + minutes + "m " + seconds + "s ";
  58.  
  59. // If the count down is finished, write some text
  60. if (distance < 0) {
  61. clearInterval(x);
  62. document.getElementById("demo" + j).innerHTML = "EXPIRED";
  63.  
  64. }
  65. }
  66. }, 1000);
  67.  
  68.  
  69. </script>
  70.  
  71.  
  72. <hr class="mt-0 mb-4">
  73.  
  74.  
  75.  
  76. <input type="submit" value="dodaj timer"
  77. onclick="window.location='add';" /><br>
  78.  
  79. </div>
  80. </div>
  81. </div>
  82. </body>
  83. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement