Created
August 2, 2021 12:59
-
-
Save MoisesTedeschi/c02478828ce1bade21dbcf310a346361 to your computer and use it in GitHub Desktop.
Contador não zerado
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="contagem"> | |
Faltam apenas | |
<mark><span class="numero" id="dia"></span> DIAS, <span id="hora"></span> HORAS, | |
<span class="numero" id="minuto"></span> MINUTOS</mark> E <mark><span class="numero" id="segundo"></span> SEGUNDOS</mark> | |
</div> | |
<script> | |
var target_date = new Date("aug 02, 2021 20:00:00").getTime(); | |
var dias, horas, minutos, segundos; | |
var regressiva = document.getElementById("regressiva"); | |
setInterval(function () { | |
var current_date = new Date().getTime(); | |
var segundos_f = (target_date - current_date) / 1000; | |
dias = parseInt(segundos_f / 86400); | |
segundos_f = segundos_f % 86400; | |
horas = parseInt(segundos_f / 3600); | |
segundos_f = segundos_f % 3600; | |
minutos = parseInt(segundos_f / 60); | |
segundos = parseInt(segundos_f % 60); | |
document.getElementById('dia').innerHTML = dias; | |
document.getElementById('hora').innerHTML = horas; | |
document.getElementById('minuto').innerHTML = minutos; | |
document.getElementById('segundo').innerHTML = segundos; | |
}, 1000); | |
</script> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment