Ver Mensaje Individual
  #1 (permalink)  
Antiguo 28/02/2004, 16:09
j_aspillaga
 
Fecha de Ingreso: septiembre-2003
Mensajes: 248
Antigüedad: 21 años, 5 meses
Puntos: 2
Pregunta problema con reloj cuuntdown

hola a todos, tengo el siguiente script para hacer un conteo hacia atrás, el reloj funciona mostrandose en el title, pero si le doy 5 minutos al llegar a 4 me regresa a 5.
por favor veanlo y díganme donde está el error

//limit = 600 por ser 5 minutos (5*60)

<script language="JavaScript">
<!--
var limit=300;

function aceptar()
{
document.form.submit();
}
function cerrar()
{
document.forms[0].submit();
}
function start(){
inicio = new Date();
seg = inicio.getSeconds();
time();
}
function time(){
inicio2 = new Date();
seg2 = inicio2.getSeconds();
setTimeout('time()');
titulo = (seg2 - seg);
resulf2 = titulo;
resulf = resulf2 - limit;
suma = seg - 60;
if (titulo <=-1){
resulf2 = seg2 - suma
resulf = resulf2 - limit;
}
letra = 'Tiempo restante ';
total =resulf * (-1);

secs=total % 60;
minutos=(total - secs)/60;

//document.title=letra+total+' segundos';
document.title=letra + minutos+':'+secs;
window.status=letra+total+' segundos';
if (total <= '0'){
document.forms[0].submit();
}

}

//-->
</script>
<body onunload="cerrar()" onLoad="start()">

gracias por su ayuda
__________________
Jose A