Ver Mensaje Individual
  #2 (permalink)  
Antiguo 01/04/2012, 08:13
Avatar de gjx2
gjx2
 
Fecha de Ingreso: agosto-2008
Ubicación: R.D
Mensajes: 1.153
Antigüedad: 16 años, 7 meses
Puntos: 139
Respuesta: Div canvia de fondo

Esa es una pregunta relacionada con Javascript no con Php
De todas formas te doy la solucion .

Código HTML:
Ver original
  1. <script type=text/javascript>
  2. img = new Array();
  3. img.push('images/cap.jpg');
  4. img.push('images/textura.jpg');
  5. img.push('images/textura2.jpg');
  6. index = 0;
  7. function altBg(){
  8.     var  div = document.getElementById('divImg');
  9. div.style.backgroundImage = 'url(' + img[index % img.length] + ')';
  10. index++;
  11. }
  12. window.onload = function(){
  13. setInterval('altBg()', 5000);
  14. // 5000 milisegundos equivalente a 5 segundos;
  15. };
  16.  
  17.  
  18. <div id="divImg"></div>