onClick
event of a button element to indicate that a function will run when a user clicks on the button.
We define the events in the HTML tags.
Examples of events include:
FF: Firefox, N: Netscape, E: Edge
Attribute | The Event Occurs When... | FF | N | E |
---|---|---|---|---|
|
Loading of an image is interrupted. | 1 | 3 | 4 |
|
An element loses focus. | 1 | 2 | 3 |
|
The user changes the content of a field. | 1 | 2 | 3 |
|
Mouse clicks an object. | 1 | 2 | 3 |
|
Mouse double-clicks an object. | 1 | 4 | 4 |
|
An error occurs when loading a document or an image. | 1 | 3 | 4 |
|
An element gets focus. | 1 | 2 | 3 |
|
A keyboard key is pressed. | 1 | 4 | 3 |
|
A keyboard key is pressed or held down. | 1 | 4 | 3 |
|
A keyboard key is released. | 1 | 4 | 3 |
|
A page or an image is finished loading. | 1 | 2 | 3 |
|
A mouse button is pressed. | 1 | 4 | 4 |
|
The mouse is moved. | 1 | 6 | 3 |
|
The mouse is moved off an element. | 1 | 4 | 4 |
|
The mouse is moved over an element. | 1 | 2 | 3 |
|
A mouse button is released. | 1 | 4 | 4 |
|
The reset button is clicked. | 1 | 3 | 4 |
|
A window or frame is resized. | 1 | 4 | 4 |
|
Text is selected. | 1 | 2 | 3 |
|
The submit button is clicked. | 1 | 2 | 3 |
onunload |
The user exits the page. | 1 | 2 | 3 |
Outside of a dog, a book is a man’s best friend. Inside of a dog, it’s too dark to read. — Groucho Marx on dogs |