Ver Mensaje Individual
  #14 (permalink)  
Antiguo 06/08/2009, 08:27
SeaPirates
 
Fecha de Ingreso: enero-2009
Ubicación: España
Mensajes: 786
Antigüedad: 15 años, 3 meses
Puntos: 9
Respuesta: Fondo aleatorio del div

Me sigue sin funcionar..


Código PHP:
<script src="prueba.js"></script>

 <script>  
     window.onload=function() {var elDiv = document.getElementById('imgContainer');var losFondos = new Array('http://www.google.es/images?q=tbn:DZYW1mMFrUXUAM::blog.plozano.net/wp-content/uploads/2008/05/fondos_mayo.jpg','http://www.google.es/images?q=tbn:y3s1SEvsLf2ZIM::i184.photobucket.com/albums/x79/pixvirtual/fc/109/fondos_3d_eFoY8.jpg','http://www.google.es/images?q=tbn:sRIqhc_esi_nZM::photofiltrecastellano.iespana.es/fondos.jpg','http://www.google.es/images?q=tbn:qMh1ZgWUuDVhDM::www.fondosmyspace.com/completos/fondos/1700.jpg');var indice = Math.floor(Math.random()*losFondos.length);elDiv.style.backgroundImage = 'url(' + losFondos [indice] +')';}
     </script>  
       
        <DIV id=box-lateral>   
      <DIV id=top></DIV>   
      <DIV id=imgContainer  
      style="BORDER-BOTTOM: #a0a0a0 1px solid; BORDER-LEFT: #a0a0a0 1px solid; PADDING-BOTTOM: 0px; PADDING-LEFT: 5px; WIDTH: 208px; PADDING-RIGHT: 0px; BACKGROUND-POSITION: right bottom; HEIGHT: 175px; BORDER-TOP: #a0a0a0 1px solid; BORDER-RIGHT: #a0a0a0 1px solid; PADDING-TOP: 5px"  >   
      <DIV id=enter><A class=button    
      href="index.php?s=register"><B><SPAN>Regístrate <IMG    
      src="http://images.habbos.es/websystem/release_6/flashy_arrow.gif"></SPAN></B><I></I></A>    
      </DIV></DIV>   
      <DIV id=bottom></DIV></DIV> 

y el js:

Código PHP:
var losFondos = new Array();
losFondos[1] = 'box-register/1.gif';
losFondos[2] = 'box-register/2.gif';
 
// imagen1 o imagen2.jpg son ejemplos debes colocar tus rutas a tus imagenes... 
que hago mal?