Event object
The Event object represents the state of the event, such as the element in which the event occurred, the state of the keyboard key, the position of the mouse, and the state of the mouse button.
Events are often used in conjunction with functions, functions will not be executed until the event occurs!
Event Handlers¶
One of the new features of HTML 4.0 is the ability to have HTML events trigger actions in the browser, such as launching a piece of JavaScript when the user clicks on an HTML element. Below are some common attributes that can be inserted into HTML tags to define the behavior of the event.
1. Click event
2. Double click event
3. Mouse event
onmouseover: mouse put event
onmouseout: mouse leave event
onmousemove: mouse move event
4. Keyboard events
onkeydown: keyboard down event
onkeyup: keyboard up event
5. Focus event
onfocus: focus event
onblur: focus loss event
onchange: content change event when focus is lost
6. Page load event
onload: The page is implemented when the page load is complete.
Note: When calling multiple functions, you only need to separate them with semicolons. As shown in the figure below: trigger two events at the same time
The function code corresponding to the relevant event:
Attachment: event name list