<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<div id="div">
<img id="img" src="img/0.png" />
<img id="img" src="img/0.png" />
时
<img id="img" src="img/5.png" />
<img id="img" src="img/5.png" />
分
<img id="img" src="img/8.png" />
<img id="img" src="img/8.png" />
秒
</div>
<script>
var div = document.getElementById('div');
var img = document.getElementById('img');
var imglist = document.getElementById('div').getElementsByTagName('IMG');
setInterval(function () {
var date = new Date();
var a = String(date.getHours());
var b = String(date.getMinutes());
var c = String(date.getSeconds());
if (a < 10) {
a = 0 + a
};
if (b < 10) {
b = 0 + b
};
if (c < 10) {
c = 0 + c
};
imglist[0].src = 'img/' + a[0] + '.png'
imglist[1].src = 'img/' + a[1] + '.png'
imglist[2].src = 'img/' + b[0] + '.png'
imglist[3].src = 'img/' + b[1] + '.png'
imglist[4].src = 'img/' + c[0] + '.png'
imglist[5].src = 'img/' + c[1] + '.png'
}, 1000)
</script>
</body>
</html>