Image complete Property - Check to see if the image is finished loading on body onload: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Image

Description

Image complete Property - Check to see if the image is finished loading on body onload:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<script>
function myFunction() {/*from ww  w.  ja v a 2s.  co  m*/
    console.log("Image loaded: " + document.getElementById("myImg").complete);
}
</script>
</head>

<body onload="myFunction()">

<img id="myImg" src="http://java2s.com/resources/a.png" alt="alt message" width="107" height="98">

</body>
</html>

Related Tutorials