[thelist] image onload event

Peter-Paul Koch gassinaumasis at hotmail.com
Tue Jan 8 06:40:22 CST 2002


>I need to guarantee that an image is fully loaded before firing a
>function. Easy enough in html with the onload parameter, but I am
>preloading a larger image after a user clicks on the thumbnail, then
>using the height and width of the image to open a popup of the same size as 
>the image. The images are uploaded to the site by users, for viewing by 
>different users.

>openNew('pictureUrl')
>
>function openNew(imgPath) {
>    var imgPath = imgPath;
>    var imgSrc = new Image();
>    imgSrc.src = imgPath;

At a guess, without any testing, do

imgSrc.onload = functionname;

Maybe it works. If it doesn't, let me know, I'll think on it again.

ppk

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.





More information about the thelist mailing list