Ver Mensaje Individual
  #7 (permalink)  
Antiguo 05/07/2009, 18:06
Avatar de orchating
orchating
 
Fecha de Ingreso: marzo-2009
Ubicación: Madrid
Mensajes: 92
Antigüedad: 15 años, 2 meses
Puntos: 0
Respuesta: Funciones en relojes

No me digais que e tocado pero este codigo:

Código:
  
<SCRIPT LANGUAGE="JavaScript">
  <!--
 function Reloj()
{ 
horario = new Date() 
hora_espana = horario.getUTCHours()
hora_ny = horario.getUTCHours()
hora_tk = horario.getUTCHours()
hora_sd = horario.getUTCHours()
hora_lnd = horario.getUTCHours()
minuto = horario.getMinutes() 
segundo = horario.getSeconds()

if (minuto<10) 
minuto="0"+minuto; 
if (segundo<10) 
segundo="0"+segundo; 

hora_espana=hora_espana+2;
mostrarhora=hora_espana+":"+minuto+":"+segundo
document.reloj.reloj_espana.value=mostrarhora
document.reloj.reloj_espana.style.color=(hora_espana>=8&&hora_espana<16)?'green':'red'
if (hora_espana==1) document.reloj.estado_espana.value="Apertura 8:00 A.M"
if (hora_espana==2) document.reloj.estado_espana.value="Apertura 8:00 A.M"
if (hora_espana==3) document.reloj.estado_espana.value="Apertura 8:00 A.M"
if (hora_espana==4) document.reloj.estado_espana.value="Apertura 8:00 A.M"
if (hora_espana==5) document.reloj.estado_espana.value="Apertura 8:00 A.M"
if (hora_espana==6) document.reloj.estado_espana.value="Apertura 8:00 A.M"
if (hora_espana==7) document.reloj.estado_espana.value="Apertura 8:00 A.M"
if (hora_espana==8) document.reloj.estado_espana.value="Cierre 16:00 P.M"
if (hora_espana==9) document.reloj.estado_espana.value="Cierre 16:00 P.M"
if (hora_espana==10) document.reloj.estado_espana.value="Cierre 16:00 P.M"
if (hora_espana==11) document.reloj.estado_espana.value="Cierre 16:00 P.M"
if (hora_espana==12) document.reloj.estado_espana.value="Cierre 16:00 P.M"
if (hora_espana==13) document.reloj.estado_espana.value="Cierre 16:00 P.M"
if (hora_espana==14) document.reloj.estado_espana.value="Cierre 16:00 P.M"
if (hora_espana==15) document.reloj.estado_espana.value="Cierre 16:00 P.M"
if (hora_espana==16) document.reloj.estado_espana.value="Apertura 8:00 P.M"
if (hora_espana==17) document.reloj.estado_espana.value="Apertura 8:00 A.M"
if (hora_espana==18) document.reloj.estado_espana.value="Apertura 8:00 A.M"
if (hora_espana==19) document.reloj.estado_espana.value="Apertura 8:00 A.M"
if (hora_espana==20) document.reloj.estado_espana.value="Apertura 8:00 A.M"
if (hora_espana==21) document.reloj.estado_espana.value="Apertura 8:00 A.M"
if (hora_espana==22) document.reloj.estado_espana.value="Apertura 8:00 A.M"
if (hora_espana==23) document.reloj.estado_espana.value="Apertura 8:00 A.M"
if (hora_espana==00) document.reloj.estado_espana.value="Apertura 8:00 A.M"

hora_ny=hora_ny+20;
mostrarhora2=hora_ny+":"+minuto+":"+segundo
document.reloj.reloj_ny.value=mostrarhora2
document.reloj.reloj_ny.style.color=(hora_ny>=8&&hora_ny<16)?'green':'red'
if (hora_ny==1) document.reloj.estado_ny.value="Apertura 8:00 A.M"
if (hora_ny==2) document.reloj.estado_ny.value="Apertura 8:00 A.M"
if (hora_ny==3) document.reloj.estado_ny.value="Apertura 8:00 A.M"
if (hora_ny==4) document.reloj.estado_ny.value="Apertura 8:00 A.M"
if (hora_ny==5) document.reloj.estado_ny.value="Apertura 8:00 A.M"
if (hora_ny==6) document.reloj.estado_ny.value="Apertura 8:00 A.M"
if (hora_ny==7) document.reloj.estado_ny.value="Apertura 8:00 A.M"
if (hora_ny==8) document.reloj.estado_ny.value="Cierre 16:00 P.M"
if (hora_ny==9) document.reloj.estado_ny.value="Cierre 16:00 P.M"
if (hora_ny==10) document.reloj.estado_ny.value="Cierre 16:00 P.M"
if (hora_ny==11) document.reloj.estado_ny.value="Cierre 16:00 P.M"
if (hora_ny==12) document.reloj.estado_ny.value="Cierre 16:00 P.M"
if (hora_ny==13) document.reloj.estado_ny.value="Cierre 16:00 P.M"
if (hora_ny==14) document.reloj.estado_ny.value="Cierre 16:00 P.M"
if (hora_ny==15) document.reloj.estado_ny.value="Cierre 16:00 P.M"
if (hora_ny==16) document.reloj.estado_ny.value="Apertura 8:00 A.M"
if (hora_ny==17) document.reloj.estado_ny.value="Apertura 8:00 A.M"
if (hora_ny==18) document.reloj.estado_ny.value="Apertura 8:00 A.M"
if (hora_ny==19) document.reloj.estado_ny.value="Apertura 8:00 A.M"
if (hora_ny==20) document.reloj.estado_ny.value="Apertura 8:00 A.M"
if (hora_ny==21) document.reloj.estado_ny.value="Apertura 8:00 A.M"
if (hora_ny==22) document.reloj.estado_ny.value="Apertura 8:00 A.M"
if (hora_ny==23) document.reloj.estado_ny.value="Apertura 8:00 A.M"
if (hora_ny==00) document.reloj.estado_ny.value="Apertura 8:00 A.M"

hora_tk=hora_tk+9;
mostrarhora3=hora_tk+":"+minuto+":"+segundo
document.reloj.reloj_tk.value=mostrarhora3
document.reloj.reloj_tk.style.color=(hora_tk>=8&&hora_tk<16)?'green':'red'
if (hora_tk==1) document.reloj.estado_tk.value="Apertura 8:00 A.M"
if (hora_tk==2) document.reloj.estado_tk.value="Apertura 8:00 A.M"
if (hora_tk==3) document.reloj.estado_tk.value="Apertura 8:00 A.M"
if (hora_tk==4) document.reloj.estado_tk.value="Apertura 8:00 A.M"
if (hora_tk==5) document.reloj.estado_tk.value="Apertura 8:00 A.M"
if (hora_tk==6) document.reloj.estado_tk.value="Apertura 8:00 A.M"
if (hora_tk==7) document.reloj.estado_tk.value="Apertura 8:00 A.M"
if (hora_tk==8) document.reloj.estado_tk.value="Cierre 16:00 P.M"
if (hora_tk==9) document.reloj.estado_tk.value="Cierre 16:00 P.M"
if (hora_tk==10) document.reloj.estado_tk.value="Cierre 16:00 P.M"
if (hora_tk==11) document.reloj.estado_tk.value="Cierre 16:00 P.M"
if (hora_tk==12) document.reloj.estado_tk.value="Cierre 16:00 P.M"
if (hora_tk==13) document.reloj.estado_tk.value="Cierre 16:00 P.M"
if (hora_tk==14) document.reloj.estado_tk.value="Cierre 16:00 P.M"
if (hora_tk==15) document.reloj.estado_tk.value="Cierre 16:00 P.M"
if (hora_tk==16) document.reloj.estado_tk.value="Apertura 8:00 A.M"
if (hora_tk==17) document.reloj.estado_tk.value="Apertura 8:00 A.M"
if (hora_tk==18) document.reloj.estado_tk.value="Apertura 8:00 A.M"
if (hora_tk==19) document.reloj.estado_tk.value="Apertura 8:00 A.M"
if (hora_tk==20) document.reloj.estado_tk.value="Apertura 8:00 A.M"
if (hora_tk==21) document.reloj.estado_tk.value="Apertura 8:00 A.M"
if (hora_tk==22) document.reloj.estado_tk.value="Apertura 8:00 A.M"
if (hora_tk==23) document.reloj.estado_tk.value="Apertura 8:00 A.M"
if (hora_tk==00) document.reloj.estado_tk.value="Apertura 8:00 A.M"

hora_sd=hora_sd+10;
mostrarhora4=hora_sd+":"+minuto+":"+segundo
document.reloj.reloj_sd.value=mostrarhora4
document.reloj.reloj_sd.style.color=(hora_sd>=8&&hora_sd<16)?'green':'red'
if (hora_sd==1) document.reloj.estado_sd.value="Apertura 8:00 A.M"
if (hora_sd==2) document.reloj.estado_sd.value="Apertura 8:00 A.M"
if (hora_sd==3) document.reloj.estado_sd.value="Apertura 8:00 A.M"
if (hora_sd==4) document.reloj.estado_sd.value="Apertura 8:00 A.M"
if (hora_sd==5) document.reloj.estado_sd.value="Apertura 8:00 A.M"
if (hora_sd==6) document.reloj.estado_sd.value="Apertura 8:00 A.M"
if (hora_sd==7) document.reloj.estado_sd.value="Apertura 8:00 A.M"
if (hora_sd==8) document.reloj.estado_sd.value="Cierre 16:00 P.M"
if (hora_sd==9) document.reloj.estado_sd.value="Cierre 16:00 P.M"
if (hora_sd==10) document.reloj.estado_sd.value="Cierre 16:00 P.M"
if (hora_sd==11) document.reloj.estado_sd.value="Cierre 16:00 P.M"
if (hora_sd==12) document.reloj.estado_sd.value="Cierre 16:00 P.M"
if (hora_sd==13) document.reloj.estado_sd.value="Cierre 16:00 P.M"
if (hora_sd==14) document.reloj.estado_sd.value="Cierre 16:00 P.M"
if (hora_sd==15) document.reloj.estado_sd.value="Cierre 16:00 P.M"
if (hora_sd==16) document.reloj.estado_sd.value="Apertura 8:00 A.M"
if (hora_sd==17) document.reloj.estado_sd.value="Apertura 8:00 A.M"
if (hora_sd==18) document.reloj.estado_sd.value="Apertura 8:00 A.M"
if (hora_sd==19) document.reloj.estado_sd.value="Apertura 8:00 A.M"
if (hora_sd==20) document.reloj.estado_sd.value="Apertura 8:00 A.M"
if (hora_sd==21) document.reloj.estado_sd.value="Apertura 8:00 A.M"
if (hora_sd==22) document.reloj.estado_sd.value="Apertura 8:00 A.M"
if (hora_sd==23) document.reloj.estado_sd.value="Apertura 8:00 A.M"
if (hora_sd==00) document.reloj.estado_sd.value="Apertura 8:00 A.M"

setTimeout("Reloj()",1000)
}
 //-->
  </SCRIPT>
 <BODY onLoad="Reloj()">
 <table>
  <tr>
<td width="193" height="88" class="menu3"><form name="reloj">
<B>Espa&ntilde;a</B><BR>
<input type="text" name="reloj_espana" size="8" Style="border:none;font-weight:bolder;font-family:verdana;"><BR>
<input type="text" name="estado_espana" size="17" Style="border:none;font-weight:bolder;font-family:verdana;"><BR><BR>

<B>Nueva York</B><BR>
<input type="text" name="reloj_ny" size="8" Style="border:none;font-weight:bolder;font-family:verdana;"><BR>
<input type="text" name="estado_ny" size="17" Style="border:none;font-weight:bolder;font-family:verdana;"><BR><BR>

<B>Tokio</B><BR>
<input type="text" name="reloj_tk" size="8" Style="border:none;font-weight:bolder;font-family:verdana;"><BR>
<input type="text" name="estado_tk" size="17" Style="border:none;font-weight:bolder;font-family:verdana;"><BR><BR>

<B>Sydney</B><BR>
<input type="text" name="reloj_sd" size="8" Style="border:none;font-weight:bolder;font-family:verdana;"><BR>
<input type="text" name="estado_sd" size="17" Style="border:none;font-weight:bolder;font-family:verdana;"><BR><BR>
</form></td>
</tr>
</table>
 </BODY>
</HTML>
me va perfectamente ahora las 2:04 en madrid me pone esa hora y no las 66:04 como ponia antes prueben y me dicen.