Ver Mensaje Individual
  #1 (permalink)  
Antiguo 18/05/2012, 16:53
Avatar de Doommarine_Maxi
Doommarine_Maxi
 
Fecha de Ingreso: febrero-2011
Mensajes: 54
Antigüedad: 13 años, 2 meses
Puntos: 8
Duda con IE6 enviando una parámetro a una función

Hola a todos, pues tuve un problema con internet explorer 6 al tratar de usar javascript y arrays bidimensionales para cambiar imagenes con una funcion que utiliza un timer.

Código Javascript:
Ver original
  1. var img_ac = new Array(4);
  2. var img_max = new Array(4);
  3. var img_opac = new Array(4);
  4. var img_tesp = new Array(4);
  5. var imagenes = new Array(4);
  6. var navegador = navigator.appName;
  7. imagenes[0] = new Array(3);
  8. img_ac[0] = 0;
  9. img_tesp[0] = 0;
  10. img_max[0] = 3;
  11. img_opac[0] = 0.0;
  12. imagenes[0][1] = "imagenes/01.jpg";
  13. imagenes[0][2] = "imagenes/02.jpg";
  14. imagenes[0][3] = "imagenes/03.jpg";
  15. imagenes[1] = new Array(2);
  16. img_ac[1] = 0;
  17. img_tesp[1] = 0;
  18. img_max[1] = 2;
  19. img_opac[1] = 0.0;
  20. imagenes[1][1] = "imagenes/Encabezado/la01.jpg";
  21. imagenes[1][2] = "imagenes/Encabezado/la02.jpg";
  22. imagenes[2] = new Array(2);
  23. img_ac[2] = 0;
  24. img_tesp[2] = 0;
  25. img_max[2] = 2;
  26. img_opac[2] = 0.0;
  27. imagenes[2][1] = "Imagenes/Fondo_sinluz.jpg";
  28. imagenes[2][2] = "Imagenes/Fondo_conluz.jpg";
  29. function c_img(etiqueta, img)
  30. {
  31.     if (etiqueta == "body")
  32.     {
  33.         document.body.style.backgroundImage = 'url(' + img + ')';
  34.     } else {
  35.         document.getElementById(etiqueta).style.backgroundImage = 'url(' + img + ')';
  36.     }
  37. }
  38.  
  39. function  trans_img(etiqueta, ID, tiempo)
  40. {
  41.         if (img_ac[ID] < img_max[ID])
  42.         {
  43.                 img_ac[ID]++;
  44.         } else {
  45.                 img_ac[ID] = 1;
  46.         }
  47.         var f_imgac = img_ac[ID];
  48.         c_img(etiqueta, imagenes[ID][f_imgac]); /*Aqui esta el problema en IE6 */
  49.         setTimeout(trans_img, tiempo, etiqueta, ID, tiempo);
  50. }
El error que me devuelve IE6 es
"imagenes[...]' is null or not an object
Línea: 48
Carácter: 3
Código: 0"

En google chrome y firefox el código funciona de maravilla.