|Unobtrusive Event Handling with Prototype|
is commonly used to add functionality to HTML documents.
There are two ways to do this, with level one event handlers or using
handler to an event at a time and is deeply coupled to your HTML
markup. The other allows you to assign as many event handlers to an
Do you know which is which? This tutorial will cover what the
Event Handler Types
So what is wrong with that? It has always worked in the past, right? There are two issues with the above: coupling and event overriding.
Coupling and Event Overriding
To associate a handler to an event we call Event.observe with three parameters: an element (window in this case), the event to trigger the handler (in this case load), and finally a function to be called. In this case we defined the function inline, however you can define the handler elsewhere as well.
Add your own comment...