Ver Mensaje Individual
  #1 (permalink)  
Antiguo 03/01/2016, 18:09
dip0813000254
 
Fecha de Ingreso: enero-2016
Ubicación: neuquen
Mensajes: 19
Antigüedad: 8 años, 4 meses
Puntos: 0
Pregunta agregar variable a funcion de horarios

encontré el siguiente código en el foro y tengo una consulta acerca de él.

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.    //domingo
  9.     if(day == 0){
  10.         if ((hours>=0) && (hours< 6)) {txthello="domingo madrugada";}
  11.         else if ((hours>=6) && (hours< 20)) {txthello="domingo tarde";}
  12.         else if ((hours>=20) && (hours< 24)) {txthello="domingo noche";}
  13.     }
  14.  
  15.     //martes
  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< 24)) {txthello=" MARTES NOCHE";}
  20.     }
  21.    
  22.          
  23.    document.write(txthello + '<br/>');
  24. }
  25. mensajes();
  26.    
  27. </script>

quiero incluir la siguiente variable

Código Javascript:
Ver original
  1. var minutes= now.getMinutes();

como podria hacer para incluirla en:

Código Javascript:
Ver original
  1. if ((hours>=0) && (hours< 6)) {txthello="domingo madrugada";}

para que pueda colocar el texto por ejemplo a las 12 y media

y lo otro es si hay alguna manera de llamar a mensajes(); o como puedo incluir el
Código Javascript:
Ver original
  1. document.write(txthello + '<br/>');
en una etiqueta h4 para incluirle css


desde ya muchas gracias