What is the difference between
<img id="el" src="HD.jpg" onload="loadImage();">
function loadImage() {...}
and
<img id="el" src="HD.jpg">
document.getElementById('el').onload=loadImage();
?
Example 1 triggers the function when the image is fully loaded, example2 triggers it even before the first bit of image is loaded. Isn't it supposed to be the same thing ?
The difference is hard to spot with a full speed internet access but obvious with a narrow one.
Notice that
document.getElementById('el').src.onload=loadImage();
doesn't work either.
Thanks
edit: sorry for the approximative post title, don't hesitate to suggest a proper one.