Como dicen arriba, toca usar js.
Te dejo lo que haría, pero antes que nada el elemento html en el cual se tratará la cuenta atras debe ser de esta forma:
<div id="someID">mm:ss:cc</div>
Código Javascript
:
Ver originalfunction countDown(timer, restart, cooldown, intv, callback){
var time = timer.innerHTML.split(":");
var c = parseInt(time[2]);
var s = parseInt(time[1]);
var m = parseInt(time[0]);
var stop = false;
if(--c < 0){
c = 99;
if(--s < 0){
s = 59;
if(--m < 0){
stop = true;
m = restart;
s = 0;
c = 0;
// callback(); <--- if you want to use the callback remove the bars !!
}
}
}
if(c < 10){ c = "0"+c; }
if(s < 10){ s = "0"+s; }
if(m < 10){ m = "0"+m; }
timer.innerHTML = m+":"+s+":"+c;
if(stop){
clearInterval(intv);
setTimeout(function(){
intv = setInterval(function(){ countDown(timer, restart, cooldown, intv, callback); },10);
},cooldown);
}
}
Parametros:
timer = elemento en el cual se trabajara
restart = minutos del reinicio (20 en este caso)
cooldown = tiempo para reiniciar la cuenta atras, en ms, si quieres esperar 5 segundos, entonces usas 5000
intv = la variable que contiene el intervalo de esta funcion
callback = funcion a ejecutar al terminar la cuenta atras
Entonces podrias hacer algo así
Código Javascript
:
Ver originalvar cuentaAtras = setInterval( function(){ countDown(document.getElementById('timer'), 20, 3000, cuentaAtras, algunaFuncion) },10);
Te recuerdo que ese ultimo 10 es necesario, ya que js trabaja con milisegundos (10^-3), y estamos trabajando con centesimas (10^-2) de segundo, por lo tanto tenemos que hacer la conversion:
10^-3/10^-2 = 10
Espero no haber cometido algun error
Saludos