Ver Mensaje Individual
  #3 (permalink)  
Antiguo 26/05/2011, 17:27
elcapitolio
 
Fecha de Ingreso: mayo-2011
Mensajes: 167
Antigüedad: 12 años, 11 meses
Puntos: 1
Respuesta: Redireccionar con cuenta regresiva y con opcion de detener la redireccion

No lo pude implementar bien...


Código PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html xmlns="http://www.w3.org/1999/xhtml">
<
head>
<
meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<
title>Documento sin título</title>
</
head>
 
<
body>
 
<
script type="text/javascript"
var 
contador = function(tiempointervalo){
 var 
enCurso 0intv intervalo || 1000;
 var 
veces tiempo intveste thistimer;
 
this.empezar = function(callback){
  
enCurso 1;
  
timer setTimeout(function(){
   if(
veces && enCurso){
    
callback(veces-- * intv);
    
setTimeout(function(){ este.empezar(callback); }, intv);
   }else{
    return 
enCurso 0;
   }
  }, 
intv);
 };
 
this.parar = function(){
  if(
enCurso){ enCurso 0; }
 };
}
var 
cuentaAtras = new contador(10000);
document.body.onload = function(){ cuentaAtras.empezar(function(tiempo){
 
document.getElementById('cuenta').innerHTML 'Quedan ' tiempo 1000 ' segundos';
 if(!
tiempo){ location.href 'otrapagina.php'; }
}); }
document.getElementById('boton-parar').onclick cuentaAtras.parar;
</script>
<input name="" type="button"  id"boton-parar" />
<p>

</body>
</html> 
Me pueden ayudar!