WebAIM - Web Accessibility In Mind

E-mail List Archives

RE: (no subject)

for

From: Christian Heilmann
Date: May 6, 2005 6:52AM


>function pframe(numb){
>> var MyMap = "/images/index/map_"+numb+".gif";
>> document['map'].src=MyMap;
>> misc = "";
>> for(a = 0; a < sarray[numb].length; a++){
>> misc += (sarray[numb][a]);
>> }
>> //alert(misc);
>> document.getElementById('mainpage').innerHTML = "";
>> document.getElementById('mainpage').innerHTML = misc;
>> //alert("/images/index/"+numb+"-1.jpg");
>> document['pic1'].src="/images/index/"+numb+"-1.jpg";
>> document['pic2'].src="/images/index/"+numb+"-2.jpg";
>> document['pic3'].src="/images/index/"+numb+"-3.jpg";
>> document['pic4'].src="/images/index/"+numb+"-4.jpg";
>> misc = "";
>> MyMap = "";
>> }
>>
>> But for some reason or other the pics dont get loaded correctly
>>
>> if I keep clicking the link (has the onclick="pframe()") about three times.
>> Then only does the pics appear.


That is a horrible function, relying on a non-standard DOM in MSIE.
What is the sarray Array? Or even better, what do you try to do?

Dynamically changing images in MSIE will always lead to caching
issues, that is why a more clever way is to use all images in one
image file and use background-position to only show the currently
needed one.

http://www.alistapart.com/articles/sprites/ explains that.

The more image objects you use, the slower your site will get and load.

The other question on my mind is why do you post this on this list?

-- Chris Heilmann
Blog: http://www.wait-till-i.com
Writing: http://icant.co.uk/
Binaries: http://www.onlinetools.org/