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

Object

Event Handler

Button

onClick, onDblClick, onMouseDown, onMouseOut, onMouseOver

Document

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

Form

onReset, onSubmit

Image

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

Layer

onMouseOut, onMouseOver

Link

onClick, onKeyDown, onKeyPress, onKeyUp, onMouseOut, onMouseOver

Select

OnChange

Text input elements

onBlur, onChange, onFocus, onKeyDown, onKeyPress, onKeyUp

Window

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

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net