Ver Mensaje Individual
  #1 (permalink)  
Antiguo 30/05/2009, 03:08
Avatar de engonga
engonga
Usuario no validado
 
Fecha de Ingreso: marzo-2002
Ubicación: Buenos Aires
Mensajes: 1.300
Antigüedad: 22 años, 2 meses
Puntos: 8
slide shows imagenes pero en el background

hola estoy intando adaptar este script

http://javascript.tunait.com/javascr...tacionimagenes

(con ayuda de tunait!!)

pero para que la imagen que se va sustituyendo sea el background de una <table>

aqui el codigo
Código HTML:
/*********************************************************
Presentación de Imágenes (SlideShow) por Tunait!
Actualizado el 28/12/2003 
Si quieres usar este script en tu sitio eres libre de hacerlo con 
la condición de que permanezcan intactas estas líneas, osea, los créditos. 
http://javascript.tunait.com
[email protected] 
**********************************************************/

var segundos = 3 //cada cuantos segundos cambia la imagen
var dire = "imatges" //directorio o ruta donde están las imágenes
var imagenes=new Array()
imagenes[0]="imatge_portada_1.jpg"
imagenes[1]="imatge_portada_2.jpg"
imagenes[2]="imatge_portada_3.jpg"
//imagenes[3]="imatges/imatge_portada_4.jpg" 
//imagenes[4]="imatges/imatge_portada_5.jpg" 
//imagenes[5]="imatges/imatge_portada_6.jpg" 
//imagenes[6]="imatges/imatge_portada_7.jpg" 
if(dire != "" && dire.charAt(dire.length-1) != "/")
{dire = dire + "/"}
var preImagenes = new Array()
for (pre = 0; pre < imagenes.length; pre++){
   preImagenes[pre] = new Image()
   preImagenes[pre].src = dire + imagenes[pre]
   }
cont=0
function presImagen(){
 
document.foto.src= dire + imagenes[cont]
subeOpacidad()
if (cont < imagenes.length-1)
   {cont ++}
else
   {cont=0}
tiempo=window.setTimeout('bajaOpacidad()',segundos*1000)
}
var iex = navigator.appName=="Microsoft Internet Explorer" ? true : false;
var fi = iex?'filters.alpha.opacity':'style.MozOpacity'
var opa = iex ? 100 : 1;
function bajaOpacidad(){
eval(opa)
if(opa >= 0){
   cambia()
   opa -= iex?10:0.1;
   setTimeout('bajaOpacidad()',10)
   }
else{presImagen()}
}
function subeOpacidad(){
opaci = iex?100:1;
if(opa <= opaci){
   cambia()
   opa += iex?10: 0.1;
   setTimeout('subeOpacidad()',10)
   }
}
function cambia(){
eval('document.foto.' + fi + ' = opa')
}
var tiempo
function inicio(){
clearTimeout(tiempo)
bajaOpacidad()
}
function inicio2(){
document.getElementById('foto').style.backgroundImage = 'url(imatges/imatge_portada_3.jpg)';
}
tunait me dijo que posiblemente canviando

Código HTML:
document.foto.src= dire + imagenes[cont]
por esto

Código HTML:
document.getElementById('foto').style.backgroundImage = dire + imagenes[cont];
podria funcionar dandole a la tabla ei id="foto"

pero no funciona me salta un error en la linea
Código HTML:
function cambia(){
eval('document.foto.' + fi + ' = opa')
}
alguien me puede ehacr una mano?