Ver Mensaje Individual
  #6 (permalink)  
Antiguo 08/04/2012, 18:14
pistonasos
 
Fecha de Ingreso: julio-2009
Ubicación: La Plata
Mensajes: 233
Antigüedad: 14 años, 9 meses
Puntos: 8
Respuesta: Pasar imagenes con pausa entre ellas

Hola, en tu caso, en vez de asignarle un fondo a un elemento, tendrías que agregarle un imagen a un elemento.Eso se puede hacer de dos maneras:
Mediante DOM (Un poco más flexible y limpia)
Mediante innerHTML
Por ej:
Código Javascript:
Ver original
  1. //Mediante DOM
  2. nImg=document.createElement("img")
  3. nImg.src="srcDeLaImagen.png"
  4. document.getElementById("miDiv").appendChild(nImg)
  5. //Mediante innerHTML
  6. document.getElementById("miDiv").innerHTML="<img width='400px' height='200px' src='srcDeLaImagen.png' />"
Buscá en google sobre ambos.
Por el script, lo modifiqué y probé en Opera:
Código Javascript:
Ver original
  1. fondoDin=function(ele,fondos)
  2. {
  3.     this.key="fondoDin"+new Date().getTime()+new Date().getMilliseconds()
  4.     if(typeof(obj)=="undefined")
  5.         {
  6.             obj=new Array()
  7.         }
  8.     obj[this.key]=this
  9.     this.cont=0
  10.     this.ele=ele
  11.     this.conf=new Array()
  12.     this.conf.extra=""
  13.     this.conf.fondos=fondos
  14.     this.conf.retardo=10000
  15.     this.conf.bucle=1
  16.     this.nImg=""
  17.     this.detona=function()
  18.     {
  19.         if(this.nImg)
  20.         {
  21.             this.ele.removeChild(this.nImg)
  22.         }
  23.         this.nImg=document.createElement("img")
  24.         this.nImg.src=this.conf.fondos[this.cont]
  25.         this.ele.appendChild(this.nImg)
  26.         if(this.cont==this.conf.fondos.length-1)
  27.             {
  28.                 if(this.conf.bucle)
  29.                     {
  30.                         this.cont=0
  31.                     }
  32.                 else
  33.                     {
  34.                         eval(this.conf.extra)
  35.                         return 0
  36.                     }
  37.             }
  38.         else
  39.             {
  40.                 this.cont++
  41.             }
  42.         this.timer=setTimeout("obj['"+this.key+"'].detona()",this.conf.retardo)
  43.     }
  44.     this.aborta=function()
  45.     {
  46.         if(typeof(this.timer)!="undefined")
  47.             {
  48.                 clearTimeout(this.timer)
  49.             }
  50.     }
  51. }
Código HTML:
Ver original
  1.     <head>
  2.         <title></title>
  3.         <link rel="stylesheet" type="text/css" href="./index.css" />
  4.         <script type="text/javascript" src="./index.js"></script>
  5.     </head>
  6.     <body>
  7.         <table>
  8.             <tbody>
  9.                 <tr><td name="destino"></td></tr>
  10.             </tbody>
  11.         </table>
  12.         <script type="text/javascript">
  13.             imgArr=["http://www.puntogeek.com/wp-content/uploads/2010/06/DebianDark.jpg","http://ejercitogeek.net/wp-content/uploads/2011/02/debian-6-cd.jpg","http://www.puntogeek.com/wp-content/uploads/2008/04/codigo-fuente-windows-vista.gif"]
  14.             imgDin=new fondoDin(document.getElementsByName("destino")[0],imgArr)
  15.             imgDin.conf.retardo=5000
  16.             imgDin.detona()
  17.         </script>
  18.     </body>
  19. </html>

Probalo y contame cómo te fué.