Ver Mensaje Individual
  #5 (permalink)  
Antiguo 05/08/2009, 08:06
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
     
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);alert(indice);elDiv.style.backgroundImage 'url("img/'losFondos [indice] +'")';} 
     
</script> 
      
        <DIV id=box-lateral>  
      <DIV id=top></DIV>  
      <DIV id=imgContainer 
      style="BACKGROUND-IMAGE: url(http://images.habbos.es/websystem/release_6/box-register/156.gif); 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> 
Edito:

Se me ha ocurrido esto:

<script type="text/javascript">
var MAX = 10;
var num_aleatorio = Math.round(Math.random()*(MAX));
document.write(num_aleatorio);
</script>

Mostrar cada vez 1 numero pero no se como mostrar ese numero entre la url

style="BACKGROUND-IMAGE: url(http://images.habbos.es/websystem/re...leatorio.gif);


com o se podria hacer para que el numero aleatorio aparezca entre la url y el gif?

Última edición por SeaPirates; 05/08/2009 a las 08:16