Image complete Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Image

Description

The complete property returns whether or not the image is loaded.

Return Value

A Boolean that indicates whether the browser is finished loading the image.

The following code shows how to Check to see if the image is finished loading:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<script>
function myFunction() {//from  w  w  w  . ja  v a  2 s. com
    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