JavaScript Objects and Event Handlers

So far in this book, when an event has been used, mostly it has been the onClick event of an HTML form in a document loaded in a Web browser. (An exception to this was the example in the “ Events ” section of Chapter 7, “ Working with Objects,” which showed the onMouseOver event of the Link object.)

I’ve used the button’s onClick event in all these examples to keep things simple. For the most part in these examples, the demonstration code launches when the user clicks the button. This book is about programming, not the specific events that apply to the object model exposed by a document loaded in a browser window, so I haven’t gone into much detail about events. But it’s worth getting a more general feeling for the kind of events that are likely to be associated with objects. You should know that the name for an event may vary depending on the application exposing the events, and, as I mentioned in the sidebar “ Different Event Models,” it’s worth looking carefully at the event model exposed by each and every application. They’re all likely to be at least somewhat different.

Table 8-1 shows the most common events associated with objects exposed to JavaScript by HTML pages loaded in a Web browser.

Table 8-1: . Objects and Associated Event Handlers


Event Handler


onClick, onDblClick, onMouseDown, onMouseOut, onMouseOver


onDblClick, onKeyDown, onKeyPress, onKeyUp, onMouseDown, onMouseOut, onMouseOver


onReset, onSubmit


onAbort, onDblClick, onError, onKeyDown, onKeyPress, onKeyUp, onLoad, onMouseOut, onMouseOver


onMouseOut, onMouseOver


onClick, onKeyDown, onKeyPress, onKeyUp, onMouseOut, onMouseOver



Text input elements

onBlur, onChange, onFocus, onKeyDown, onKeyPress, onKeyUp


onBlur, onFocus, onLoad, onResize, onUnload

Learn How to Program Using Any Web Browser
Learn How to Program Using Any Web Browser
ISBN: 1590591135
EAN: 2147483647
Year: 2006
Pages: 115
Authors: Harold Davis

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: