<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
.div1{
color:#fff;
background: #171717;
font-size:50px;
text-align:center;
}
</style>
</head>
<script>
function getDate(n){
if(n<10){
return '0'+n;
}else{
return ''+n;
}
}
window.onload=function(){
var oImg=document.getElementsByTagName('img');
function timer(){
var oDate=new Date();
var str=getDate(oDate.getHours())+getDate(oDate.getMinutes())+getDate(oDate.getSeconds());
for(var i=0;i<oImg.length;i++){
oImg[i].src='images/'+str[i]+'.png';
}
}
setInterval(timer,1000);
timer();
}
</script>
<body class="div1">
<img src="images/0.png">
<img src="images/0.png">
:
<img src="images/0.png">
<img src="images/0.png">
:
<img src="images/0.png">
<img src="images/0.png">
</body>
</html>
数码时钟
最新推荐文章于 2020-04-04 09:56:06 发布