WebReference.com - Chapter 6 of Dynamic HTML: The Definitive Reference, 2nd Edition. From O'Reilly. | WebReference

WebReference.com - Chapter 6 of Dynamic HTML: The Definitive Reference, 2nd Edition. From O'Reilly.

Dynamic HTML: The Definitive Reference, 2nd Edition

Dynamic HTML: The Definitive Reference, 2nd Edition Book Cover

Chapter 6: Scripting Events

A graphical user interface constantly monitors the computer's activity for signs of life from devices such as the mouse, keyboard, network port, and so on. Programs are written to respond to specific actions, called events, and run some code based on numerous conditions associated with the event. For example, was the Shift key held down while the mouse button was clicked? Where was the text insertion pointer when a keyboard key was pressed? As you can see, an event is more than the explicit action initiated by the user or system--an event also has information associated with it that reveals details about the state of the world when the event occurred.

In a Dynamic HTML page, you can use a scripting language such as JavaScript (or VBScript in Internet Explorer for Windows) to instruct a visible element to execute some script statements when the user does something with that element. The bulk of scripts you write for documents concern themselves with responding to user and system actions after the document has loaded. In this chapter, we'll examine the events that are available for scripting and discuss how to associate an event with an object. We'll also explore how to manage events in the more complex and conflicting event models within the IE and W3C DOMs.

Excerpt Contents


Created: August 29, 2002
Revised: September 9, 2002

URL: https://webreference.com/programming/javascript/dhtmlref/chap6/