Ver Mensaje Individual
  #3 (permalink)  
Antiguo 22/12/2005, 15:56
nngg
 
Fecha de Ingreso: marzo-2005
Mensajes: 201
Antigüedad: 19 años, 1 mes
Puntos: 0
Va de nuevo por si lo pegué mal, pero este seguro funciona. Gracias

endDate = new Date(2006, 00, 01, 00, 00, 00, 00);
timeLeft = (endDate-new Date());
var d = 24*60*60*1000;
var h = 60*60*1000;
var m = 60*1000;
var s = 1000;
Math.dosDigitos = function(value) {
return (value<10) ? ("0"+value) : (value);
};
function calculate(factor) {
var result = Math.floor(timeLeft/factor);
timeLeft -= (result*factor);
return Math.dosDigitos(result);
}
getTimeLeft = function () { timeLeft = (endDate-new Date());if (timeLeft>0) {dias = calculate(d);horas = calculate(h);minutos = calculate(m);segundos = Math.dosDigitos(Math.floor(timeLeft/1000));campo.text = dias+" días, "+horas+" : "+minutos+" : "+segundos;} else {campo.text = "00 días, 00 : 00 : 00";clearInterval(id);}};
this.createTextField("campo", 1, 0, 0, 0, 0);
this.campo.autoSize = true;
id = setInterval(getTimeLeft, 1000);
stop();