Level 0
Level 1

Events

All interactions that users have on a web page are essentially events. Events are triggered by the user when for example clicking with the mouse on an image or pressing a key or even when the webpage finished loading. An event is simply a notification that an action has taken place. Simply noting a change is not enough though, in order to actually do something with this information we have to hook an action to it and listen to the specific events. We can add this hook by using event handlers, they allow us to listen to a particular event and execute a function when it is triggered. Events are about broadcasting and receiving, when a notification is received it needs to be processed.

Understand events

Events allow as a matter of fact for interactivity on web pages. They actually make web content dynamic and enable Javascript to execute certain functions.

Instructions
Resources

Unravel event handling

An action triggers an event; an event calls an event handler; an event handler executes a function. Event handlers are simple scripts that call certain functions. For example, the onload event handler can trigger a pop-up window when the page you have visited just finished loading.

Instructions
Resources

Set up your own event

Interactivity is important for making a website appealing. There are many events and all have their specific eventhandler, for example onmousedown triggers obviously when the mouseclick is clicked. But there are many more; have a look at the wide range of eventhandlers and choose the one you need to complete the next task.

Instructions
Resources