robard
04-30-2005, 08:44 PM
I am developing a web site (www.sceneshifts.com) and I would like to know when an image has loaded. The user clicks on a thumbnail and that calls a javascript function which loads the image. I have tried all kinds of code combinations - for example:
function LoadImage(pic)
{
myimage = new Image();
myimage = pic;
myimage.unload;
myimage.onload = SomeFunction(myimage);
document["mainPicture"].src = myimage;
}
mainPicture is preloaded from the html form. What happens is that the SomeFunction function gets called immediately, not after myimage has loaded. Can you help?
function LoadImage(pic)
{
myimage = new Image();
myimage = pic;
myimage.unload;
myimage.onload = SomeFunction(myimage);
document["mainPicture"].src = myimage;
}
mainPicture is preloaded from the html form. What happens is that the SomeFunction function gets called immediately, not after myimage has loaded. Can you help?