Ver Mensaje Individual
  #2 (permalink)  
Antiguo 20/06/2011, 15:49
MARCASTELEON
 
Fecha de Ingreso: octubre-2010
Mensajes: 107
Antigüedad: 13 años, 6 meses
Puntos: 14
Respuesta: Imagenes en movmiento con javascript

Hola, aca pongo un ejemplo de como se puede hacer con javaScript
Cambias la direccion de las imagenes segun la hora
Código Javascript:
Ver original
  1. <html xmlns="http://www.w3.org/1999/xhtml">
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  4. <title>Untitled Document</title>
  5. <script language="JavaScript">
  6.  
  7. function imagen(){
  8.    fecha = new Date();
  9.    
  10.    hora = fecha.getHours();
  11.    
  12.    if(hora>=1 && hora<=10){//imagen desde la 1am hasta las 10am
  13.       document.getElementById("fondo").style.backgroundImage="url(http://www.lasiesta-hotel.com/content/imgsxml/descargas_imagenes/restaurante0007.jpg)";
  14.    }
  15.    
  16.    if(hora>=11 && hora<=18){//imagen desde las 11am hasta las 6pm
  17.       document.getElementById("fondo").style.backgroundImage="url(http://www.lasiesta-hotel.com/content/imgsxml/descargas_imagenes/restaurante0007.jpg)";
  18.    }
  19.    
  20.    if(hora>=19 && hora<=24){//imagen desde las 7pm hasta las 12pm
  21.       document.getElementById("fondo").style.backgroundImage="url(http://www.lasiesta-hotel.com/content/imgsxml/descargas_imagenes/restaurante0007.jpg)";
  22.    }
  23.    
  24.                }
  25. </script>
  26. </head>
  27. <body id="fondo" onload="imagen()">
  28. </body>
  29. </html>