Examples of JS time control to achieve dynamic results and js instances
As follows:
<Script> BOM // Bowers Object Model: the Object Model of the browser setTimeout () // The setInterval () execution is delayed once. // The interval is var a = 300; window. setTimeout ('abc (a) ', 3000); // value assignment function abc (I) {alert (I) ;}// setInterval ('alert (123) ', 2000); var dh = document. getElementById ("dh"); // alert (dh. offsetLeft); function move () {dh. style. marginLeft = dh. offsetLeft + 1 + 'px ';} var x = window. setInterval ('move () ', 20); var y = window. setInterval ('move () ', 500); function clear () {window. clearInterval (x);} // execute window to clear the interval. setTimeout ("clear ()", 2500); // code to be executed; interval window. setInterval ('alert (123) ', 1000); </script> Use Time Control to perform clock operations <style> * {margin: 150px auto; width: 500px; height: 500px ;} </style> <body> <div> <span id = "h"> </span> <span id = "m"> </span> <span id = "s "> </span> </div> <script type =" text/javascript "> window. setInterval ("time ()", 1000); custom time function time () {Date and time function call var time = new Date (); document. getElementById ("h "). innerText = time. getHours () + ':'; document. getElementById ("m "). innerText = time. getMinutes () + ':'; document. getElementById ("s "). innerText = time. getSeconds () ;}</script> </body>
The example of the above JS time control to achieve dynamic results is all the content shared by Alibaba Cloud xiaobian. I hope to give you a reference and support for the customer's house.