JavaScript
  Home arrow JavaScript arrow Handling events with the DOM – Part I
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Dedicated Servers  
Actuate Whitepapers 
VeriSign Whitepapers 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
IBM developerWorks
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
JAVASCRIPT

Handling events with the DOM – Part I
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 11
    2005-04-19

    Table of Contents:
  • Handling events with the DOM – Part I
  • Back to basics: assigning event handlers
  • Understanding the DOM event flow: Event Capture and Event Bubble
  • Inline and scripted event handlers into action

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
    Iron Speed
     
    ADVERTISEMENT

    At the virtual BlackBerry Technical Seminar 2008, you can ask your development questions directly of Research In Motion® (RIM) experts, and take advantage of learning opportunities designed uniquely for BlackBerry solution developers. Register Today!

    Handling events with the DOM – Part I


    (Page 1 of 4 )

    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.

    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. 

    More JavaScript Articles
    More By Alejandro Gervasio


       · In the first part of the series, the concepts of bubble and capture phase are...
     

    JAVASCRIPT ARTICLES

    - Using the Style Object for Zebra Tables with...
    - Binary Searching
    - An Improved Approach to Building Zebra Tables
    - Assigning Background Colors Dynamically to Z...
    - Building Zebra Tables with CSS and JavaScript
    - JavaScript: Array Objects
    - A Closer Look at Smart Markers with Yahoo! M...
    - Using Polylines and Smart Markers with Yahoo...
    - Bulleted Menu of Links
    - Creating Click Loggers and Basic Markers wit...
    - Adding Pan Controls to Yahoo! Maps
    - Adding Zoom Controls to Yahoo! Maps
    - Working with Yahoo! Maps
    - Building Image Zooming Controls with the DOM...
    - Working with Multiple Graphics for a Zoom Ap...

    Iron Speed

    Iron Speed





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway