Ver Mensaje Individual
  #5 (permalink)  
Antiguo 26/12/2009, 11:29
bebo
 
Fecha de Ingreso: octubre-2009
Mensajes: 97
Antigüedad: 15 años, 3 meses
Puntos: 4
Respuesta: problemilla con script

Tu síntaxis está mal en ésta línea:
document.write (/hl);
Cambiala por:
document.write("</hl>");

Y si quieres un reloj que se actualize cada segundo:
Código HTML:
Ver original
  1. function reloj(){var fecha=new Date();
  2. var hora=fecha.getHours();if(hora<10){hora="0"+new String(hora)}else{hora=hora}
  3. var minuto=fecha.getMinutes();if(minuto<10){minuto="0"+new String(minuto)}else{minuto=minuto}
  4. var segundo=fecha.getSeconds();if(segundo<10){segundo="0"+new String(segundo)}else{segundo=segundo}
  5. var dia=fecha.getDate();
  6. var meses=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"];
  7. var dias={0:"Domingo",1:"Lunes",2:"Martes",3:"Miércoles",4:"Jueves",5:"Viernes",6:"Sábado"};
  8. var mes=meses[fecha.getMonth()];
  9. var ano=fecha.getFullYear();
  10. var contenido="Son las "+hora+":"+minuto+":"+segundo+" del "+dias[fecha.getDay()]+", "+dia+" de "+mes+" del "+ano;
  11. document.getElementById("reloj").innerHTML=contenido;
  12. setTimeout("reloj()",1000);
  13. }
  14. window.onload=function(){reloj()}
  15. <span id="reloj"></span>