Javascript Question, onClick and Loading Images

I want to run this code, it changes the main image on the screen. It works fine after all the optional images are loaded, but not while they are loading.

document.all[ ‘DispImage’ ].src = source ;

It’s called from the onClick event of a link, if it’s called from the HREF of a link it stops all the optional images that haven’t finished loading from loading, which is not good as then you can’t see the images that are options to display.

I’ve tried putting alerts before and after this line of code and they are always triggered fine, but the image is still never displayed until all the images are loaded or at least most of the images are loaded. I think it maybe something to do with my PC (P4 2.66HT 1GB RAM & XP) but I doubt it.

The ideal is to have the images load away in there own time (obviously the faster the better) and be able to click on all the visible images (which are the links that display the pic in the main view area) and change between the visible ones.

Any help would be very much appreciated, or even pointers or explanations as to why the onClick will not work until the page has finished loading.

Many thanks in advance

Ross

PS. Don’t suppose anyone has a link to a stunningly brilliant Javascript resource site. Thanks.

Subject: Javascript Question, onClick and Loading Images

Hi Ross,

What web browser are you using? IE5x or IE6 or NS or Firefox?

You can find some good links here for Lotus Domino/JS/HTML and more…

http://chuckshomeworld.com/links/Developer/

A great JavaScript book is “JavaScript: The Definitive Guide” by David Flanagan, published by O’Reilly. I have the 4th edition (upgraded from the 3rd edition) and use it all the time.

Chuck

Subject: RE: Javascript Question, onClick and Loading Images

Using IE6.

Is this similar to something that you’ve encountered before?

Subject: RE: Javascript Question, onClick and Loading Images

I don’t think I have run into this problem before, but I’ve probably never tried to do what you are trying to do. I have experience delays when the page won’t display, but the onload event has been triggered. Its not consistent and I’m not sure if it is IE6 or not.

I’m currently experience issues where after a rather complicated JS runs, there is a delay of up to maybe 10 seconds before the browser starts responding again. I’ve not been able to track it down, I’m assuming its the garbage collection that is taking place after the script function executes.