Exécuter
❯
Exécuter le code
Ctrl+Alt+R
Enregistrer le code
Ctrl+Alt+A
Changer d'orientation
Ctrl+Alt+O
Changer de thème
Ctrl+Alt+D
<!DOCTYPE html> <html> <head> <script> function imgError() { alert('L\'image n\'a pas pu être chargée.'); } </script> </head> <body> <h1>Événements HTML JavaScript</h1> <h2>L'attribut onerror</h2> <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> </html>