<div class="codetitle"> <span><a style="CURSOR: pointer" data="21158" class="copybut" id="copybut21158" onclick="doCopy('code21158')"><u>Copy code</u></a></span> The code is as follows:</div> <div class="codebody" id="code21158"> <br><span style="font-size:18px">< ;html> <br><span style="white-space:pre"> </span><body> <br><span style="white-space:pre"> </span> ; <script language = javascript> <br><span style="white-space:pre"> </span> setInterval("test()",1000); <br>function test () <br>{ <br><span style="white-space:pre"> </span>var a= new Date(); <br><span style="white-space:pre"> < ;/span>document.getElementById("time").innerHTML= a; <br>} <br><span style="white-space:pre"> </span> </script> <br><span style="white-space:pre"> </span> <h1 id = "time"> <br><span style="white-space:pre"> </ span> </h1> <br></body> <br></html> <br></span> <br> </div> <br>I don’t know what setInterval means, so Baidu Down. <br><br> Found this to mean: <br><br> The setInterval() method can call a function or calculate an expression according to the specified period (in milliseconds). <br>The setInterval() method will keep calling the function until clearInterval() is called or the window is closed. The ID value returned by setInterval() can be used as an argument to the clearInterval() method. <br><br>The method provided by w3school is: <br><div class="codetitle"> <span><a style="CURSOR: pointer" data="12873" class="copybut" id="copybut12873" onclick="doCopy('code12873')"><u>Copy the code</u></a></span> The code is as follows:</div> <div class="codebody" id="code12873"> <br> setInterval(code, millisec[,"lang"]) <br> </div> <br>code is the function to be called, millisec is the period, and the time is calculated in milliseconds <br><div class="codetitle"> <span><a style="CURSOR: pointer" data="90846" class="copybut" id="copybut90846" onclick="doCopy('code90846')"><u>Copy code</u></a></span> The code is as follows:</div> <div class="codebody" id="code90846"> <br><html> <br><body> <br><br><input type="text" id="clock" size="35" /> <br><script language=javascript> <br>var int=self.setInterval("clock()",50) <br>function clock() <br>{ <br>var t=new Date() <br>document.getElementById("clock").value=t <br>} <br></script> <br></form> <br> <button onclick="int=window.clearInterval(int)"> <br>Stop interval</button><br></body> <br></html> <br> </div>