Ver Mensaje Individual
  #6 (permalink)  
Antiguo 01/10/2013, 15:11
Avatar de Javier01
Javier01
 
Fecha de Ingreso: febrero-2008
Ubicación: Montevideo
Mensajes: 261
Antigüedad: 16 años, 2 meses
Puntos: 31
Respuesta: Texto que cambie según el dia de la semana y según la hora

Puedes hacerlo con lo que ya tenias y con lo que te pasó bathorz:
Algo como esto tal vez te sirva:
Código Javascript:
Ver original
  1. <script language="javascript">
  2. function mensajes(){
  3.    var txthello="";
  4.    var now = new Date();
  5.    var day = now.getDay();
  6.    var hours = now.getHours();
  7.  
  8.    //Agrego el dia domingo con sus 3 mensajes segun la hora
  9.     if(day == 0){
  10.         if ((hours>=0) && (hours<6)) {txthello=" DOMINGO MADRUGADA";}
  11.         else if ((hours>=6) && (hours<21)) {txthello=" DOMINGO DIA";}
  12.         else if ((hours>=21) && (hours<0)) {txthello=" DOMINGO NOCHE";}
  13.     }
  14.    
  15.     //Agrego otro dia (el martes) con sus 3 mensajes segun la hora
  16.     else if(day == 2){
  17.         if ((hours>=0) && (hours<6)) {txthello=" MARTES MADRUGADA";}
  18.         else if ((hours>=6) && (hours<21)) {txthello=" MARTES DIA";}
  19.         else if ((hours>=21) && (hours<0)) {txthello=" MARTES NOCHE";}
  20.     }
  21.    
  22.          
  23.    document.write(txthello + '<br/>');
  24. }
  25.  
  26.  
  27. mensajes(); //llamo a la funcion para que muestre el mensaje correspondiente
  28. </script>

saludos
__________________
Tomarse un tiempo para redactar correctamente la pregunta, utilizando los signos de puntuación adecuados, es ganar tiempo y calidad en la respuesta.