// Declare the image image = new Image; image.src = "image.jpg"; // Use a loop with the following code in it if (image.complete) { alert("The image is completely loaded"); }