我需要制作一个页面,随着时间的推移,每 5 秒更改一次时间,30 秒后我需要显示 30 秒已经过去的通知
function showClock(){
var d=new Date();
var hours=d.getHours();
var minutes=d.getMinutes();
var seconds=d.getSeconds();
var clock=document.getElementById("clock");
clock.innerHTML=`<h1>${hours}:${minutes}:${seconds}</h1>`;
}
setInterval(showClock,1000);
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<section id="main"></section>
<section id="clock"></section>
</body>
</html>
收到一只叮咚
相关分类