Javascript-форум (https://javascript.ru/forum/)
-   Internet Explorer (https://javascript.ru/forum/css-html-internet-explorer/)
-   -   Проблема с img.onload в IE7, IE8 (https://javascript.ru/forum/css-html-internet-explorer/23266-problema-s-img-onload-v-ie7-ie8.html)

Genius 18.11.2011 12:03

Проблема с img.onload в IE7, IE8
 
Для фотогалереи в массив из объектов IMG загружаются картинки:

for (j=0; j<var3; j++)
{
         Images[j] = new Image (w, h);
         Images[j].onload = img_onload (j);
         Images[j].src = var2;
}
function img_onload (cnt)       { img_loaded[cnt] = true; }


Во всех браузерах, кроме IE7, IE8 - всё OK. А в указанных ослах ошибка в строке, где
Images[j].onload = img_onload (j);


Какие могут быть пути разрешения проблемы? :blink:

vflash 18.11.2011 12:16

может так ?
function img_onload (cnt) {return function(){img_loaded[cnt] = true;} }

UDN 18.11.2011 17:21

Событию Images[j].onload, нужно присваивать функцию, а не значение или еще что...

function img_onload (cnt)       { img_loaded[cnt] = true; }
alert(img_onload);


тобишь Images[j].onload = img_onload;


Часовой пояс GMT +3, время: 08:06.