Using onload on an <img> element.
Alert "Image is loaded" immediately after an image has been loaded:
<!DOCTYPE html> <html> <body> <img src="image1.png" onload="loadImage()" width="100" height="132"> <p id="demo"></p> <script> function loadImage() {/* w w w . j ava 2 s . c om*/ document.getElementById("demo").innerHTML = "Image is loaded"; } </script> </body> </html>