You are here: JAVAScript/Event

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


What are events?


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

Which events should we focus on from a JavaScript point of view?

It all depends on the JavaScript program we are writing, that is, on the objectives we want to achieve with our script.
However, the most common events we are likely to deal with in our JavaScript are:

  • onLoad / onUnload;
  • onClick;
  • onSubmit (triggered by the user submitting a form);
  • onFocus / onBlur (triggered by a user as, for example, she clicks in a textbox or clicks away from a textbox respectively);
  • onMouseOver / onMouseOut (triggered by the user moving the mouse over or away from an HTML element respectively);
  • onKeyDown / onKeyUp(triggered if any key down or up)

Blog

Active User (5)

 Log In to Chat