Press "Enter" to skip to content

Onerror Example in JavaScript

Definition :

This is a event which triggers a function whenever an exception has been encountered in the image.

Program :



      <script language=”javascript”>

                      function display()


                                                alert(“sorry couldn’t find image”);





                  <img src=”Desert.jpg” onerror=”display()”/>



Be First to Comment

    Leave a Reply

    Your email address will not be published. Required fields are marked *