-1
I wonder if anyone can help me create a timer, a counter in the existing code. It’s like 600, but I’d like to create the time that would be like 10:00, being minutes and seconds.
<html lang="br">
<head>
<title>Contador com barra de progresso</title>
<meta charset="utf-8">
<style>
.barra-progresso{width: 406px;height: 24px;background-color: #bbb;border-radius: 13px;padding: 3px;margin: 50px auto;}
.porcentagem{width: 100%;height: 24px;border-radius: 10px;background-color: dodgerblue;}
</style>
<script>
var g_iCount = new Number();
var g_iCount = 600+1;
function contagem(){
var prg = document.getElementById('progresso-da-barra');
if((g_iCount - 1) >= 0){
g_iCount = g_iCount - 1;
mostracontagem.innerText = g_iCount;
tempo_restante = g_iCount / 6;
prg.style.width = tempo_restante + '%';
setTimeout('contagem()',1000);
}
}
</script>
</head>
<body onload="contagem();">
<div class="barra-progresso">
<div class="porcentagem" id="progresso-da-barra"></div>
<div id="mostracontagem"><div>
</div>
</body>
</html>
the question was unclear, 10:00 like? in minutes and hours?
– 13dev
minutes and seconds.
– Daniel dalla colletta