Home  >  Article  >  Web Front-end  >  JavaScript implements simple clock example code_javascript skills

JavaScript implements simple clock example code_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:12:50868browse

Copy code The code is as follows:

JS implements a simple clock
<script></p> <p> function displayTime() {<br> document.getElementById("time").innerHTML = new Date().toTimeString();<br> } <br><br> setInterval(displayTime,1000); // Call the displayTime function every 1 second <br></script>


 



JavaScript implements simple clock example code_javascript skills

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn