HTML and CSS Reference
In-Depth Information
<body bgcolor="white">
<div align="center">
<image src="Image/java_steam.gif"
onError="alert('Image is having trouble loading!')">
<input type="button"
value="Wake me"
onClick="wakeupCall()" />
The <image> tag identifies the src of a .gif image to be loaded from a subdirectory
called Image .
The onError event handler is triggered when an error occurs while loading the
image. See Figure 13.28.
Figure 13.28 The onError event handler was triggered because the image src was
wrong (left), and after the image loads (right).
13.7 The event Object
As we have seen throughout this text, events are happening all the time with JavaScript.
Event objects are sent to an event handler with each event that occurs within a docu-
ment; for example, when the user clicks on the left mouse button, JavaScript registers
the event, what key was pressed, its coordinates (pixel positions of where it was pressed
on the screen), and so on. To learn more about what happened so that you can track
problems, get pixel coordinates, find out what button was pushed or what key was
released, and so on, the event object provides specific information about the event. This
topic can be very confusing because W3C, Mozilla/Firefox type browsers, and Microsoft
Internet Explorer differ in how events should be handled. Like economists argue over
Search WWH ::

Custom Search