How to use HTML DOM Image onerror in JavaScript
In this article i am going to explain about onerror event in JavaScript.
HTML DOM image onerror event
The HTMl DOM image onerror event fired if an error occur when loading an image.
Syntax of image onerror event
onerror="Code of JavaScript"
|
Browser support
The image onerror event is supported in all major browser.
Example of image onerror event
<!DOCTYPE html>
<html>
<body>
<img src="new.gif" onerror="alert('The image could not be loaded.')" />
<h1>Onerror Event</h1>
</body>
</html>
|
Output:
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