Home > Web Front-end > Front-end Q&A > What are the common events in javascript

What are the common events in javascript

青灯夜游
Release: 2021-06-22 18:25:30
Original
2522 people have browsed it

Common JavaScript events: click, dblclick, mouseup, mouseout, keypress, keydown, keyup, error, load, resize, unload, blur, change, focus, reset, etc.

What are the common events in javascript

The operating environment of this tutorial: windows7 system, javascript version 1.8.5, Dell G3 computer.

One of the basic features of JavaScript is event-driven. The so-called event-driven means that when the user performs a certain operation or the interaction between Javascript and html results in a certain state change, a series of program response executions will be triggered. Here, the user's operation is called an event, and the program's response to the event is called event processing.

Event processing refers to the program's response to events. For JavaScript, an event is an operation that occurs when a user interacts with a Web page or something that changes a certain state after the interaction between Javascript and HTML, such as moving the mouse, pressing a key, clicking a button, etc., and expressing Ajax The working status changes, indicating that the animation has completed running, etc. The program involved in event handling is called an event handler. Event handlers are usually defined as functions.

Interface elements that generate events in a Web page are called event sources. The same type of events can be generated on different event sources, and the same event source can also generate different types of events. The JS program specifies the event type and event source, and binds an event handler to the event source. In this way, once an event of a specified type occurs in the event source, the browser will call the handler bound to the event source for event processing. So the work involved in event processing includes the definition of event handlers and their binding.

In a Web page, there are many operations that users can perform, and each operation will generate an event. Let me introduce to you some common events in JavaScript.

## Mouse eventclickThis event is triggered when the user clicks the mousedblclickThis event is triggered when the user double-clicks the mousemousedownThis event is triggered when the user presses the mouse mouseupAfter the user presses the mouse This event is triggered when the mouse is releasedmouseoverThis event is triggered when the user moves the mouse cursor over an object rangemousemoveThis event is triggered when the user moves the mousemouseoutThis event is triggered when the user's mouse cursor leaves the scope of an object EventmousewheelThis event occurs when the mouse wheel is scrolled. It is only valid for IE and ChromeDOMMouseScrollThis event occurs when the mouse wheel is rolled, valid for standard browsersKeyboard eventkeypressWhen the user presses the This event is triggered when a certain character key is pressedkeydownThis event is triggered when a key on the user's keyboard is pressedkeyupThis event is triggered when a key on the user's keyboard is pressed and then released Window event errorThis event is triggered when an error occurs while loading a file or imageloadThis event is triggered when the page content is loadedresizeThis event is triggered when the browser window size is changedunloadWhen the current page is closed or exited Trigger this eventForm eventblurTrigger this event when the form element loses focusclickThis event is triggered when the user clicks the check box, radio button, normal button, submit button, reset button and other buttonschangeThis event is triggered when the content of the form element changes and the element loses focusfocusThis event is triggered when the form element gains focusresetThis event is triggered when the user clicks the reset button on the form selectThe user selects a This event is triggered when the text in the input or textarea form elementsubmitThis event is triggered when the user clicks the submit button to submit the form
JavaScript Common Events
Event Description
[Related recommendations:

javascript learning tutorial]

The above is the detailed content of What are the common events in javascript. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template