Tema: Get time!
Ver Mensaje Individual
  #2 (permalink)  
Antiguo 30/03/2002, 12:27
Avatar de Kaopectate
Kaopectate
Colaborador
 
Fecha de Ingreso: diciembre-2001
Ubicación: Curaçao (Antillas Holandesas)
Mensajes: 3.179
Antigüedad: 22 años, 4 meses
Puntos: 38
Re: Get time!

He probado el script y funciona muy bien, he añadido un botón que llama a un popup para ver si la ausencia de foco la afecta y he encontrado que no la afecta.

Para añadir el resultado a un formulario es muy sencillo. Te devuelvo tu código modificado:

Código:
<html>
 <head>
  <script>
   var txtP='Tiempo de visita'
   var segun2=0;
   var minut2=0;
   var horas2=0

   function tPermanencia(){
    var txts2 = ''; var txtm2 = ''; segun2 += 1;
    if (segun2 == 60){
     segun2 = 0;
     minut2 += 1;
    }
    if (minut2 == 60){
     minut2 = 0;
     horas2 += 1;
    }
    if (segun2 < 10) txts2 = '0';
    if (minut2 < 10) txtm2='0';
    window.status = 'Tiempo de visita ' + horas2 + ':' + txtm2 + minut2 + ':' + txts2 + segun2;
    if (typeof(document.formulario) != "undefined"){
     document.formulario.tiempo.value = horas2 + ':' + txtm2 + minut2 + ':' + txts2 + segun2;
    }
    setTimeout("tPermanencia()", 1000)
   }

   function callFn(){
    open("nof11.htm");
   }

   tPermanencia();
  </script>
 </head>
 <body>
  <form name="formulario">
   <input type="button" value="popup" onclick="callFn()">
   <input type="text" name="tiempo" value="">
  </form>
 </body>
</html>
Suerte.