6
Well what I wanted was to make a 60-second timer.
which would work as follows: Count 60 seconds down 60.59.58, 57, etc... and when you hit 0, pause 0 for 3 seconds, and start all over again 60.59, 58 etc...
How can I do that?
Thank you first of all.
The code is not working.
– Gonçalo
@Gonçalo strange, I’m running the code here in the OS and it’s working as it should. The counter starts at 60, decreases to 0.1 per second, and stops at 0 for 3 seconds. Then repeats the process eternally.
– tayllan
Can you send me the full code.
– Gonçalo
I already did, I had put the <p>Timer: <span id="timer">60</span></p> underneath.
– Gonçalo
Tell me one thing what is the variable that takes time, in real time?
– Gonçalo
I’m not sure I understand your question.
novoValor
is the variable that will, every second, have the current value of the counter. When the timer is in45
,novoValor
will equal45
.– tayllan
And tell me something, has the timer be general, ie be for everyone, because when I give F5, the timer back to 60 seconds.
– Gonçalo
That is when it is 45 seconds for me, whether for someone else who is on the page at the same time.
– Gonçalo
Um, there is, but it’s going to get a little complicated. I’ll update my answer in a little while to reflect on that idea of yours.
– tayllan
Okay, thank you.
– Gonçalo
Nor, that it is necessary to keep the browser turned on 24 hours.
– Gonçalo
@Gonçalo I’m actually going to leave that out of the answer, because it’s not the scope of the question, and it’s not trivial to give an example. What you need in this case is Realtime Communication. Read on here.
– tayllan
If I edit the question, you can answer in the answer?
– Gonçalo