<span class="hours">1</span><span class="min">2</span><span class="sec">3</span>
<script>
var hour = document.querySelector('.hours');
var min = document.querySelector('.min');
var sec = document.querySelector('.sec');
var inputTime = +new Date('2021-10-6 17:00:00');
coutDown();
setInterval(coutDown, 1000);
function coutDown() {
var nowTime = + new Date();
var times = (inputTime - nowTime) / 1000;
var h = parseInt(times / 60 / 60 % 24);
h = h < 10 ? '0' + h : h;
hour.innerHTML = h;
var m=parseInt(times/60%60);
m = m < 10 ? '0' + m : m;
min.innerHTML = m;
var s = parseInt(times % 60);
s = s < 10 ? '0' + s : s;
sec.innerHTML = s;
}
</script>