codice:<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>countdown test</title> <style> #countdown { display: flex; } .endcountdown { text-decoration: line-through; } </style> </head> <body> <div id="headline"></div> <div id="countdown"></div> <script> const headline = document.getElementById("headline") const countdown = document.getElementById('countdown') const future = Date.parse("jun 15, 2022 19:46:59") function updateTimer() { const now = new Date() const diff = future - now const days = Math.floor(diff / (1000 * 60 * 60 * 24)) const hours = Math.floor((diff / (1000 * 60 * 60)) % 24) const minutes = Math.floor((diff / 1000 / 60) % 60) const seconds = Math.floor((diff / 1000) % 60) if (diff < 0) { headline.textContent = "Evento in corso!" countdown.textContent = `0 Giorni 0 Ore 0 Minuti 0 Secondi ` countdown.classList.add('endcountdown') clearInterval(CountDownTimer) } else { countdown.textContent = `${days} Giorni ${hours} Ore ${minutes} Minuti ${seconds} Secondi ` } } const CountDownTimer = (() => setInterval(updateTimer, 1000))() </script> </body> </html>