Advertisement
Guest User

Arma Machine

a guest
Jul 12th, 2017
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.50 KB | None | 0 0
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <style>
  5. p {
  6.   text-align: center;
  7.   font-size: 60px;
  8. }
  9. </style>
  10. </head>
  11. <body>
  12.  
  13. <p id="arma"> X</p>
  14. <p id="msg">Stop  the Armagedon!</p>
  15. <button onclick="stop()">STOP</button>
  16.  
  17. <script>
  18.  
  19. function stop(){
  20.   clearInterval(x);
  21.   document.getElementById("msg").innerHTML = "Gerettet";
  22. }
  23.  
  24. // Set the date we're counting down to
  25. var countDownDate = new Date("Jan 5, 2018 15:37:25").getTime();
  26.  
  27. // Update the count down every 1 second
  28. var x = setInterval(function() {
  29.  
  30.     // Get todays date and time
  31.     var now = new Date().getTime();
  32.    
  33.     // Find the distance between now an the count down date
  34.     var distance = countDownDate - now;
  35.    
  36.     // Time calculations for days, hours, minutes and seconds
  37.     var days = Math.floor(distance / (1000 * 60 * 60 * 24));
  38.     var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
  39.     var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
  40.     var seconds = Math.floor((distance % (1000 * 60)) / 1000);
  41.    
  42.     // Output the result in an element with id="arma"
  43.     document.getElementById("arma").innerHTML = days + "d " + hours + "h "
  44.     + minutes + "m " + seconds + "s ";
  45.    
  46.     // If the count down is over, write some text
  47.     if (distance < 0) {
  48.        clearInterval(x);
  49.        document.getElementById("arma").innerHTML = "Boooooommmmmmm!!!!!!!!!!!!!";
  50.        document.getElementById("msg").innerHTML = "zu spät";
  51.    }
  52. }, 1000);
  53. </script>
  54.  
  55.  
  56. </body>
  57. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement