In programming, an event is an action that occurs as a result of the user or another source, such as a mouse being clicked, or a key being pressed. An event handler is a routine that is used to deal with the event, allowing a programmer to write code that will be executed when the event occurs.
Other common event examples
- A web browser completely loading a web page.
- A file being created or modified on a filesystem.
- A hardware sensor such as a webcam or microphone receiving sensory input.
- The arrival of incoming network traffic.
- The occurrence of an error at the program or system level.
Events on the Web
<form action="#" method="post"> <input type="button" value="Click for a Message" onclick="window.alert('Hello!');"> </form>