其实主要是对一些方法的使用和算法的应用
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
#clock{
text-align: center;
background-color: #333333;
}
</style>
</head>
<body>
<div id="clock"></div>
<script>
const div = document.getElementById("clock");
aa();
function aa(){
const data = new Date();
let t = "";
t += data.getFullYear()+"年";
t += data.getMonth()+"月";
t += data.getDate()+"日";
t += "星期"+data.getDay();
t += " "+data.getHours();
t += ":"+data.getMinutes();
t += ":"+data.getSeconds();
t += " "+("00"+data.getMilliseconds()).slice(-3);
div.innerHTML = t;
setTimeout(aa,10)
}
</script>
</body>
</html>