Advertisement
Guest User

Untitled

a guest
Dec 11th, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.43 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3.  <head>
  4.   <meta name='viewport' content='width=device-width, initial-scale=1.0'/>
  5.   <meta charset='utf-8'>
  6.   <style>
  7.     body {font-size:100%;}
  8.     #main {display: table; margin: auto;  padding: 0 10px 0 10px; }
  9.     h2 {text-align:center; }
  10.     p { text-align:center; }
  11.   </style>
  12.  
  13.   <title>Detect moving</title>
  14.  </head>
  15.  
  16.  <body>
  17.    <div id='main'>
  18.      <h2>Detect moving</h2>
  19.      <div id='content'>
  20.        <p id="time"></p>
  21.        <p id"move"></p>
  22.      </div>
  23.    </div>
  24.     <script>
  25.   var dateString = "";
  26.   var h=0;
  27.   var m=0;
  28.   var s=0;
  29.    function refresh()  
  30.    {
  31.      var date = new Date();
  32.     var h=date.getHours();
  33.     var m=date.getMinutes();
  34.     var s=date.getSeconds();
  35.     dateString =h+":"+m+":"+s;
  36.     var t=document.getElementById("time").innerHTML = dateString;
  37.    }
  38.      function updateMove()
  39.     {  
  40.        ajaxLoad("getMove");
  41.     }
  42.    
  43.  
  44.     function ajaxLoad(ajaxURL)
  45.     {
  46.       ajaxRequest.onreadystatechange = function()
  47.       {
  48.         if(this.readyState == 4 && this.status==200)
  49.        {
  50.          var ajaxResult = this.responseText+"";
  51.           var m=document.getElementById("move").innerHTML = ajaxResult;
  52.         }
  53.       }
  54.       ajaxRequest.open("GET",ajaxURL,true);
  55.       ajaxRequest.send();
  56.     }
  57.    var ajaxRequest = new XMLHttpRequest();
  58.    setInterval(refresh, 1000 );
  59.    setInterval(updateMove, 1000 );
  60.  
  61.   </script>
  62.  </body>
  63. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement