jomasero
6/26/2013 - 4:31 PM

Redireccionar a otro sitio después de cierta cantidad de segundos.

Redireccionar a otro sitio después de cierta cantidad de segundos.

<!DOCTYPE html>
<html>
<head>
  <script>
    var start=new Date();
    start=Date.parse(start)/1000;
    var counts=10;
    
    function CountDown()
    {
      var now=new Date();
      now=Date.parse(now)/1000;
      var x=parseInt(counts-(now-start),10);
      if(document.form1) { document.form1.clock.value = x; }
      if(x > 0) {timerID=setTimeout("CountDown()", 100); }
      else { location.href="http://norfipc.com"; }
    }
    
    window.setTimeout('CountDown()',100);
  </script>
</head>
<body>
  <form name="form1" id="form1">
    Serás redireccionado en <input type="text" name="clock" size="2" value="10" />segundos
  </form>
</body>
</html>