Tuesday, February 28, 2012

Tutorial on Advanced JavaScript Event Handling

As an example for the basic ideas involved in this article, let us re-consider the bus problem I mentioned in the first piece. We may have designed our bus program to travel to the next destination when all the passengers are aboard and have paid. But what happens at the last stop on the bus's route?

Automatic event handling would immediately take us to the next stop on the list, probably the first stop in the list of stops. But we need greater control over the actual event. We want to ask if the bus is at the last stop on its route, and if it is, we need to stop it. This is advanced event handling.

This looks simple on the surface - but what if passengers get on at the last stop? And pay? What if people are still on the bus? Good programming would find answers to all of these problems.

Some problems do have solutions without advanced event handling, but if we are able to use advanced event handling, we will find that simple and practical solutions to these sort of problems are readily available.

Advanced Event Handling consists of three sections:
Cancelling Events
Event Bubbling
Mouse Capture

More... [1]

Links
  1. ^ More... (www.htmlgoodies.com)

No comments:

Post a Comment

Search This Blog