Home Page -> DOM Tutorials -> Using Events -> Events - Summary

Summary

We can use the addEventListener() function to make a document object react to events rather than having to use onEvent= handlers in the tags. We may look at these events as they are passed down from the document to the the target (capture), or as they are passed up from the target to its enclosing elements (bubbling).

When the event listener function is invoked, we get an Event object that tells us the target for which the event was destined. This target may not always be the object whose properties we wish to affect, so it can be necessary to walk through the target node's “family tree” until we find the node we want.

Being able to attach event listeners to a document's objects is a great convenience; knowing how to exploit the hierarchy of a document's nodes gives us immense power. We'll learn more about that in the next tutorial.

  Implementing showMenu()  Index