Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta name='viewport' content='width=device-width, initial-scale=1.0'/>
- <meta charset='utf-8'>
- <style>
- body {font-size:100%;}
- #main {display: table; margin: auto; padding: 0 10px 0 10px; }
- h2 {text-align:center; }
- p { text-align:center; }
- </style>
- <title>Detect moving</title>
- </head>
- <body>
- <div id='main'>
- <h2>Detect moving</h2>
- <div id='content'>
- <p id="time"></p>
- <p id"move"></p>
- </div>
- </div>
- <script>
- var dateString = "";
- var h=0;
- var m=0;
- var s=0;
- function refresh()
- {
- var date = new Date();
- var h=date.getHours();
- var m=date.getMinutes();
- var s=date.getSeconds();
- dateString =h+":"+m+":"+s;
- var t=document.getElementById("time").innerHTML = dateString;
- }
- function updateMove()
- {
- ajaxLoad("getMove");
- }
- function ajaxLoad(ajaxURL)
- {
- ajaxRequest.onreadystatechange = function()
- {
- if(this.readyState == 4 && this.status==200)
- {
- var ajaxResult = this.responseText+"";
- var m=document.getElementById("move").innerHTML = ajaxResult;
- }
- }
- ajaxRequest.open("GET",ajaxURL,true);
- ajaxRequest.send();
- }
- var ajaxRequest = new XMLHttpRequest();
- setInterval(refresh, 1000 );
- setInterval(updateMove, 1000 );
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement