How to use HTML DOM Image onload in JavaScript

In this article I am going to explain about a image onload event in JavaScript.
  • 1988

HTML DOM  image onload event

The HTMl  dom image onload event occur immediately after a image is loaded.

Syntax of image onload event

onload="Code of JavaScript"

Browser support

The image onload event is supported in all major browser.

Example of image  onload event

<!DOCTYPE html>



<script type="text/javascript">

    function loadImage() {

        alert("Image is loaded");






<img src="gen.jpg" onload="loadImage()" width="100" height="120" />




image onload new meth.jpg

You may also want to read these related articles :here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here


More Articles

© 2020 DotNetHeaven. All rights reserved.