• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 12. Handling Events > Handling Error Events

12.8. Handling Error Events

12.8.1. The onError Event

The error event fires when a JavaScript error has occurred (window) or when an image cannot be found (image elements).

Example 12.21.

    <html><head><title>Wake up call</title>
    <script language="javascript">
        function wakeupCall(){    // Function is defined here
            timeout=setTimeout('alert("Time to get up!")',2000);
        }
     </script>
    </head>
    <body bgcolor="white">
    <form>
    <center>
    <p>
1   <image src="Image/java_steam.gif"
2       onError="alert('Image is having trouble loading!')">
    <p>
    <input type="button"
        value="Wake me"
        onClick="wakeupCall()">
    </form>
    <center>
    </body>
    </html>


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint