javascript
JAVA回调函数的例子_javascript : 回调函数例子
數(shù)字時(shí)鐘 digital_clock.html
Digital Clock// Define a function to display the current time
function displayTime() {
var elt = document.getElementById("clock"); // Find element with id="clock"
var now = new Date(); // Get current time
elt.innerHTML = now.toLocaleTimeString(); // Make elt display it
setTimeout(displayTime, 1000); // Run again in 1 second
}
window.onload = displayTime; // Start displaying the time when document loads.
#clock { /* Style apply to element with id="clock" */
font: bold 24pt sans; /* Use a big bold font */
background: #ddf; /* On a light bluish-gray background */
padding: 10px; /* Surround it with some space */
border: solid black 2px; /* And a solid black border */
border-radius: 10px; /* Round the corners (where supported) */
}
Digital Clock
參考書:[ JavaScript 權(quán)威指南 E6] 第13章
總結(jié)
以上是生活随笔為你收集整理的JAVA回调函数的例子_javascript : 回调函数例子的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 用接口写冒泡排序
- 下一篇: 无重复字符的最长子串php,LeetCo