📅  最后修改于: 2022-03-11 15:03:01.488000             🧑  作者: Mango
var span = document.getElementById('span');
function time() {
var d = new Date();
var s = d.getSeconds();
var m = d.getMinutes();
var h = d.getHours();
span.textContent =
("0" + h)+ ":" + ("0" + m).substr(-2) + ":" + ("0" + s);
}
setInterval(time, 1000);