Every element on a dynamic or static web page has certain events which can trigger Java Script functions. For example, we can use the onClick event of a button element to indicate that a function will run when a user clicks on that button. We define the events in the HTML tags.
Examples of events:
A mouse click
A web page or an image loading
Mousing over a hot spot on the web page
Selecting an input box in an HTML form
Submitting an HTML form
Events are normally used in combination with functions, and the function can not be executed before the event occurs.