Javascript: / Home / InlineEvent

The Inline Event Handler

There are many different events that can occur and each one has a specific name. One of the most common events is a "click" event.

Event Handler code can be assigned to an element attribute. This code will be run for only that element and that is the only code that will be executed for that element event.

This is an example of the Button element running the inline event handler code to jump to a different page when it is clicked with the mouse button.
<button onclick="window.location.href='4Events.html'"><- Events</button>

The "onclick" event attribute is assigned the handler code "window.location.href='4Events.html'". This jumps to the specified page when the button is clicked.

This type of event handler code is rarely used due to its limitations.
It is sometimes used for coding examples when there are only one or two short code statements to be executed.

More Information

<- Events            EventProperty ->
5InlineEvent