How do i make a countdown timer?
I need help with making a countdown timer and notification system when it goes off, could anyone help? comment pls if you can!
In Python, you can also use the time library:
import time sec = int(input("How many seconds do you want to countdown? : ")) for i in range(1,sec+1): print(i) time.sleep(1) print("Time Up!!")
I hope it helped.
thnx! @NISHoriginal
Not at school
Hi what language?
You'll need to know some JS as well, and maybe css to make it nicer.
check this out for making the timer
https://www.w3schools.com/howto/howto_js_countdown.asp
https://www.sitepoint.com/build-javascript-countdown-timer-no-dependencies/
for the notification system, making this can help:
np :) @Ravens0606
you can use new Date()
for that @Ravens0606
i guess you can input the user to choose the timer...?
maybe this can help:
https://stackoverflow.com/questions/54658075/javascript-set-a-timer-based-on-user-input
script.js
@Ravens0606
line 44
is approx it @Ravens0606
np did it work @Ravens0606
@Ravens0606 send repl
Using the
setInterval()
JavaScript code, you can make a countdown.ok, thnx! then... what HTML do i do? @JavaMaster1
@Ravens0606
It's JavaScript, so you need to use
<script>
.@Ravens0606 easy peasy, lemon squeezy
@JavaMaster1 ah ok
@Ravens0606 Did it help? I can give you a code that way a
<p>
element shows the countdown.yes! i would like the
pls too! @JavaMaster1
but thnx! @JavaMaster1
@Ravens0606 K, here's the code:
Does it work? I used
document.getElementById()
.Im sorry, but it didnt work! @JavaMaster1
@Ravens0606 Lemme just double-check my code...
JavaScript isn't easy!
Ok! and... I agree! @JavaMaster1
@Ravens0606 Oops... I used
value
instead ofinnerHTML
.Here's the working code:
Now it should work.
@Ravens0606 Also, you should practice your JavaScript. This website is really good. It might even help you with html!
Thanks! Can i alter that in any way and have it like the person using it can choose the set time? @JavaMaster1
Ok! @JavaMaster1
@Ravens0606 K, here's the code with the user input:
Yeesh, that's a lot of code! Sorry I took so long. Does it work?
it works PERFECTLY! Thank you!! @JavaMaster1
@Ravens0606 Do I get the cycles?
yep! you get 5 cycles! @JavaMaster1
@Ravens0606 Thanks!