Ver Mensaje Individual
  #2 (permalink)  
Antiguo 20/08/2008, 15:12
Avatar de Fernand0
Fernand0
 
Fecha de Ingreso: septiembre-2005
Ubicación: Buenos Aires
Mensajes: 610
Antigüedad: 19 años, 5 meses
Puntos: 19
Respuesta: Rotar imagen de fondo

Código PHP:
<script language='javascript'>
window.onload=rotar('nombreDelIdDelFondo');
function 
rotar(id)
{
    var 
Fondos=new Array;
    
Fondos[0]="../imagen-central-historia01.jpg";
    
Fondos[1]="../imagen-central-historia02.jpg";
    
Fondos[2]="../imagen-central-historia03.jpg";
    
Fondos[3]="../imagen-central-historia04.jpg";
    
    var 
m4x=Fondos.length;
    var 
r3s=Math.round((m4x-1)*Math.random());
    
    var 
fondo=document.getElementById(id);
    
fondo.style.background='url('+Fondos[r3s]+') no-repeat';
    
setTimeout(function() { rotar(id); },2000);
}
</script> 
con esto rotaria a una imagen RANDOM cada tanto tiempo

Última edición por Fernand0; 20/08/2008 a las 15:19