const days = document.getElementById('days'), hours = document.getElementById('hours'), minutes = document.getElementById('minutes'), seconds = document.getElementById('seconds'); const dd = document.getElementById('dd'), hh = document.getElementById('hh'), mm = document.getElementById('mm'), ss = document.getElementById('ss'); const day_dot = document.querySelector('.day_dot'), hr_dot = document.querySelector('.hr_dot'), min_dot = document.querySelector('.min_dot'), sec_dot = document.querySelector('.sec_dot'); const endDate = '03/08/2026 00:00:00'; // date format mm/dd/yyyy const x= setInterval(()=>{ const now = new Date(endDate).getTime(); const countDown = new Date().getTime(); const distance = now - countDown; // 时间计算 for dats, hours, minutes and seconds let d = Math.floor(distance / (1000 * 60 * 60 * 24)); let h = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); let m = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); let s = Math.floor((distance % (1000 * 60)) / (1000)); // output the result in element with id days.innerHTML = d + "
Days" // animate stroke dd.style.strokeDashoffset = 440 - (440 * d) / 365; })