<!DOCTYPE html><html lang="zh-CN"> <head> <title>show time</title> <script> function show() { var today = new Date(); var time = today.getFullYear() + "年" + format(today.getMonth() + 1) + "月" + format(today.getDate()) + "日 " + getWeek() + " " + format(today.getHours()) + ":" + format(today.getMinutes()) + ":" + format(today.getSeconds()); document.getElementById("time").innerHTML = time; } function format(value) { if (value >= 10) return value; return "0" + value; } function getWeek() { var day = new Date().getDay(); if (day == "0") return "星期天"; if (day == "1") return "星期一"; if (day == "2") return "星期二"; if (day == "3") return "星期三"; if (day == "4") return "星期四"; if (day == "5") return "星期五"; if (day == "6") return "星期六"; return ""; } function dynamic() { show(); setInterval(function(){ show(); }, 1000); } </script> </head> <body onload="dynamic();"> <span id="time"></span> </body></html>
新闻热点
疑难解答