JavaScript Events

The web is a dynamic environment where a lot of things happen. Most appropriately, they’re called events. Some of these events, like a user clicking a button or moving the mouse over a link, are of great interest to a JavaScript coder.


  1. onClick event: triggered by you as you click the link;
  2. onUnload event: triggered by the web browser as it leaves the current web page;
  3. onLoad event: triggered by the browser as the new web page content is loaded.

Example specified below

<a href="" onclick="alert('Going anywhere? Not so fast!'); return false;">Click Me!</a>

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s