Skip to content
Sign upLog in

How do i make a countdown timer?

Profile icon
icelite

I need help with making a countdown timer and notification system when it goes off, could anyone help? comment pls if you can!

You are viewing a single comment. View All
Answered by Whacko [earned 5 cycles]
View Answer
Profile icon
Whacko

@Ravens0606
K, here's the code:

<p id="countdown">60</p> <script> var timer = 60 /* Change it to whatever you want */ var timerText = document.getElementById("countdown"); var countdown = setInterval(function() { if (timer == 0) { clearInterval(); /* End */ timerText.value = "Out of time!"; } else { timer -= 1 /* Countdown */ timerText.value = timer; }; }, 1000 /* Miloseconds */); </script>

Does it work? I used document.getElementById().