Ver Mensaje Individual
  #3 (permalink)  
Antiguo 27/11/2009, 16:27
Avatar de gigoz
gigoz
 
Fecha de Ingreso: noviembre-2009
Mensajes: 106
Antigüedad: 14 años, 5 meses
Puntos: 1
Respuesta: Reloj JavaScript que se actualice

<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>


en el body pones el OnLoad

onLoad="mueveReloj();"

<form name="form_reloj">
<input name="reloj" type="text" class="input_reloj" onFocus="window.document.form_reloj.reloj.blur()" size="10">
</form>

este funciona perfecto pruebalo y me cuenta