Ver Mensaje Individual
  #1 (permalink)  
Antiguo 13/09/2012, 22:02
Parliament
 
Fecha de Ingreso: noviembre-2003
Mensajes: 499
Antigüedad: 20 años, 5 meses
Puntos: 7
Centesimas de segundo

Amigos:
Soy conocedor de PHP pero de javascript no tengo ni idea y quiero agregarle a este codigo para que me de horas, minutos, segundos y centesimas de segundo como lo puedo hacer?. desde ya muchas gracias por su colaboracion

<script language="JavaScript">
function mueveReloj(){
momentoActual = new Date()
hora = momentoActual.getHours()
minuto = momentoActual.getMinutes()
segundo = momentoActual.getSeconds()

str_segundo = new String (segundo)
if (str_segundo.length == 1)
segundo = "0" + segundo

str_minuto = new String (minuto)
if (str_minuto.length == 1)
minuto = "0" + minuto

str_hora = new String (hora)
if (str_hora.length == 1)
hora = "0" + hora

horaImprimible = hora + " : " + minuto + " : " + segundo

document.form_reloj.reloj.value = horaImprimible

setTimeout("mueveReloj()",1000)
}
</script>
</head>

<body onload="mueveReloj()">

Vemos aquí el reloj funcionando...

<form name="form_reloj">
<input type="text" name="reloj" size="10" style="background-color : Black; color : White; font-family : Verdana, Arial, Helvetica; font-size : 8pt; text-align : center;" onfocus="window.document.form_reloj.reloj.blur()">
</form>

</body>
</html>