Advertisement
Guest User

Untitled

a guest
Nov 11th, 2016
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.58 KB | None | 0 0
  1. <html>
  2.  
  3. <head>
  4. <meta charset=”utf-8? />
  5. <meta name=”format-detection” content=”telephone=no” />
  6. <meta name=”msapplication-tap-highlight” content=”no” />
  7. <meta name=”viewport” content=”user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width/>
  8. <meta http-equiv=”Content-Security-Policy” content=”default-src * ‘unsafe-inline’; style-src ‘self’ ‘unsafe-inline’; media-src *” />
  9. <link rel="icon" href="icon.png">
  10. <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jquerymobile/1.4.5/jquery.mobile.min.css">
  11. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
  12. <script src="https://ajax.googleapis.com/ajax/libs/jquerymobile/1.4.5/jquery.mobile.min.js"></script>
  13. <title>Interactive Page</title>
  14.  
  15. </head>
  16. <style>
  17.     body{
  18.         font-size: 200%;
  19.     }
  20.     img {
  21.         max-width:100%;
  22.         height:auto;
  23.     }  
  24.     .ui-btn{
  25.         font-size: 200%;
  26.     }
  27.    
  28. </style>
  29.  
  30. <body>
  31.     <center>
  32.         <h3>Time in seconds: <text id="seconds">0</text></h3>
  33.         <button id="startBtn">Start timer!</button>
  34.     </center>
  35. </body>
  36.  
  37. <script>
  38.     var timerStarted = false;
  39.     var seconds = 0;
  40.     var timer;
  41.  
  42.     function changeTime(){
  43.         seconds += 1;
  44.         $("#seconds").html(seconds);
  45.     }
  46.    
  47.     $("#startBtn").click(
  48.         function(){
  49.             if(!timerStarted){
  50.                 timerStarted = true;
  51.                 $("#startBtn").html("End timer!");
  52.                 timer = setInterval(changeTime, 1000);
  53.             }else{
  54.                 timerStarted = false;
  55.                 $("#startBtn").html("Start timer!");
  56.                 clearInterval(timer);
  57.             }
  58.            
  59.         }
  60.     );
  61.    
  62.    
  63.    
  64.    
  65. </script>
  66.  
  67. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement