Home arrow JavaScript arrow Handling events with the DOM – Part I
JAVASCRIPT

Handling events with the DOM – Part I


In this first article in a three part series, you will learn several of the methods that the Document Object Model offers for capturing and handling events that happen within the context of a Web document.

Author Info:
By: Alejandro Gervasio
Rating: 4 stars4 stars4 stars4 stars4 stars / 12
April 19, 2005
TABLE OF CONTENTS:
  1. · Handling events with the DOM – Part I
  2. · Back to basics: assigning event handlers
  3. · Understanding the DOM event flow: Event Capture and Event Bubble
  4. · Inline and scripted event handlers into action

print this article
SEARCH DEVARTICLES

Handling events with the DOM – Part I
(Page 1 of 4 )

Introduction

If you ever have written some JavaScript code to be included in your Web pages, then you’re certainly very familiar with manipulating responses generated by events occurring within the context of a Web document.

In JavaScript parlance, this concept is widely known as event handling. Actually, event handling has been present in the language since its primitive origins, in a valid attempt to programmatically handle most of the user’s actions and window events, triggering specific processes in response to them. By applying these language-native capabilities, we’re able to manipulate form submissions, mouse clicks or page loads, and other common events, adding more interactivity to websites and allowing general control over determined user-generated events. 

Specifically, the DOM (Document Object Model) offers several methods or functions to capture and handle events, providing a straightforward and standard way for doing so. However, there is a flip side. While the W3C (W3 Consortium) have been making a strong effort to establish common DOM standards, browser manufacturers have branched out in different directions, implementing some proprietary DOM constructs, and several glaring incompatibilities. Despite this, there is a lot to be gained from using these abilities. 

In the first part of this article series, we’ll explore the DOM event handling area in its most common aspects, as an introduction for those Web developers wishing to dig a little deeper into this terrain. Finally, a few short disclaimers: this article is not meant to be a complete reference to the DOM event handling. There are many good books out there that thoroughly cover the subject. Also, as new DOM standards are introduced or modified, you should always check http://www.w3.org/TR/2000/CR-DOM-Level-2-20000307/events.html for updated information. 

With the preliminaries out of the way, let’s make our way through the DOM event handling. 


blog comments powered by Disqus
JAVASCRIPT ARTICLES

- Project Nashorn to Make Java, JavaScript Wor...
- JavaScript Virus Attacks Tumblr Blogs
- Google Releases Stable Dart Version, JavaScr...
- Khan Academy Unveils New JavaScript Learning...
- Accessing Nitro? There`s an App for That
- JQuery 2.0 Leaving Older IE Versions Behind
- Fastest JavaScript Engine Might Surprise You
- Microsoft Adjusting Chakra for IE 10
- Brendan Eich: We Don`t Need Google Native Cl...
- An Overview of JavaScript Statements
- An Overview of JavaScript Operators
- Overview of JavaScript Variables
- More of the Top jQuery Social Plugins
- The Top jQuery Social Plugins
- More of the Top jQuery Slider Plugins

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials