mercoledì, marzo 11, 2009

Using a JavaScript Onload Event With an Image

The blog called “The Future of the Web,” has a nice explanation of using a JavaScript onload event with an image. I’ve added the resulting code excerpt for searching, but do check out his blog to get the full explanation.

var image = new Image();
image.onload = function() {
    // always called
    alert('image loaded');
};
image.src = 'image.jpg';