Timing-related: 1 . After the specified time to do one thing setTimeout (js statement ms) 2 from time to time to do one thing. SetInterval (JS statements milliseconds) clearInterval (setInterval variable name) eliminating duplicate event <DOCTYPE html! > <HTML lang = " ZH-the CN " > <head> <Meta HTTP-equiv = " Content-the Type " charset = " UTF-. 8 " > <Meta HTTP-equiv = " X-UA-compatible " Content = " IEs Edge = " > <title> the title </ title> </ head> <body> <input type="text" id="i1"> <button id="b1">开始</button> <button id="b2">停止</button> <script> var i1Ele = document.getElementById("i1"); var t; function f() { var now = new Date(); i1Ele.value = now.toLocaleString(); } f(); var b1Ele = document.getElementById("b1"); point to start// b1Ele.onclick = function (EV) { IF (! T) { T = the setInterval (F, 1000 ) } }; var b2Ele = document.getElementById ( " B2 " ); // stop is b2Ele.onclick = function (EV) { the clearInterval (T); // Clear The scheduled task ID the console.log (T); T = null; } </ Script> </ body> </ HTML>