Tryit Editor v2.3

Edit This Code:
<!DOCTYPE html> <html> <head> <script> function imgError() { alert('The image could not be loaded.'); } </script> </head> <body> <img src="image.html" onerror="imgError()"> <p>A function is triggered if an error occurs when loading the image. The function shows an alert box with a text. In this example we refer to an image that does not exist, therefore the onerror event occurs.</p> </body> <!-- Mirrored from www.w3schools.com/js/tryit.asp?filename=tryjs_events_onerror by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 23 Jan 2015 07:37:21 GMT --> </html>
Result:
Try it Yourself - © w3schools.com