運用 HTML5 + CSS3 + JavaScript 運行網頁 ( 數位時鐘 ) – 讓網站分秒都美參考程式碼

<!DOCTYPE html>       <!– This is an HTML5 file –>
<html>                            <!– The root element –>
<head>                           <!– Title, scripts & styles go here –>
<title>數位時鐘</title>
<script>                          // A script of js code
                  // 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.
</script>
<style>                              /* A CSS stylesheet for the clock */
#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) */
}
</style>
</head>

<body>                          <!– The body is the displayed parts of the doc. –>
<h1>{ HTML5 + CSS3 + JavaScript 數位時鐘 }</h1>   <!– Display a title –>
<span id=”clock”></span>                    <!– The time gets inserted here –>
</body>
</html>

 

admin

網站名稱:多 1 個站長,風雨生信心 網站連結:https://www.techx.idv.tw 網站站長 : 洪金水 網站簡介:佛學法布施、本站有 { 牟尼佛法流通網 } 連結 http://www.muni-buddha.com.tw、專業軟體、IBM 原廠設備、電腦週邊、客戶現場維修經驗分享、實用 Windows、Linux、磁碟陣列架設、電腦備份還原軟體應用、植栽經驗分享、等等圖文教學文章、多 1 個站長,風雨生信心、實用資訊分享、等等圖文教學文章、LAMP WordPress 6 系列 [ 實際架站經驗 ] 分享教學、生命就該《 濃 純 香 》、 { 佛說大乘無量壽莊嚴清淨平等覺經 } 淨空法師 MP4 影片共 188 集,雅瑟 USHER 音響使用心得等等。

這裡是 [ 多 1 個站長,風雨生信心 ],「您好,喜歡這篇文章嗎?有沒有問題或想法想要分享?留言讓小編知道!或者,您也可以像一位探險家一樣,穿過這個網站,發現更多有趣的文章和深入的內容,小編期待著與您一起展開這場冒險!」,如果小編的作品有幫助到您,歡迎支持讓網站永續經營,您的支持是小編能夠持續提供優質內容和服務的重要動力 ! ( 請透過站內商品 [ Logo 或安全連結 ] 購買站內 ( 推薦優良 ) 商品🙏!)