daily pastebin goal
38%
SHARE
TWEET

Untitled

a guest Jun 14th, 2018 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <title>Title</title>
  6. </head>
  7. <body>
  8. <input type="text" id="time" style="border:3px solid blue; text-align:center; font-size:2em;" disabled="true"/>
  9. <script>window.onload = function() {
  10.     countdown(600);
  11. }
  12. function countdown(startTime) {
  13.     let time = startTime;
  14.     let box = document.getElementById('time');
  15.     let intervalID = setInterval(decrement, 1000);
  16.    
  17.     function decrement() {
  18.         time--;
  19.         box.value = Math.trunc(time / 60) + ':' + ('0' + (time % 60)).slice(-2);
  20.     }
  21. }
  22. </script>
  23.  
  24. </body>
  25. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top