Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the meaning of event object in javascript

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article is about what event objects mean in javascript. Xiaobian thinks it is quite practical, so share it with everyone for reference. Let's follow Xiaobian and have a look.

In javascript, an event object is an object used to record information about when an event occurs; the event object is generated only when the event occurs, and can only be accessed internally by the event handler, and is destroyed after all event handlers have run.

Operating environment of this tutorial: Windows 7 system, Javascript version 1.8.5, Dell G3 computer.

What is an event object:

An event object is an object that records information about when an event occurs.

Event objects are generated only when events occur, and can only be accessed internally by event handlers. After all event handlers run, event objects are destroyed!

Note: Events always exist (with or without binding or listening), it just doesn't have event handlers!!!

JavaScript events are specific moments of interaction that occur in browsers, document windows, and interaction between JavaScript and HTML is triggered by events.

Event handlers:

Event handler: the action of clicking on the page, the action of moving the mouse, the action of loading the web page, etc. can be called the event name.

Click, move, load, etc. are all event names. A function that responds to an event is called an event handler, or event listener.

Event Type:

Events in JavaScript are divided into three categories: general events, form events, and page events.

UI events: such as load, unload, error, resize, scroll, select, DOMActive, are triggered when the user interacts with elements on the page.

Focus events: such as blur, DOMFocusIn, DOMFocusOut, focus, focusin, focusout, triggered when the element gains or loses focus, among these events, the most important are blur and focus, there is one point to pay attention to, this kind of event will not bubble!

Mouse and wheel events: such as click, dblclick, mousedown, mouseenter, mouseleave, mousemove, mouseout, mouseover, mouseup, are triggered when the user performs operations on the page through the mouse.

Wheel events: mousewheel (supported by IE6+), DOMMouseScroll (supported by FF, the same effect as mousewheel). Is triggered when using the mouse wheel.

Text event: textInput, triggered by entering text in a document.

Keyboard events: keydown, keyup, keypress, triggered when the user performs an action on the page via the keyboard.

Compositing events: DOM level 3 new for processing IME input sequences. IME refers to an input method editor that allows users to enter characters that are not found on a physical keyboard. There are three types of events: compositionstart, compositionupdate and compositionend.

Change events: DOMSubtreeModified, DOMNodeInserted, DOMNodeRemoved, DOMAttrModified, DOMCharacteristDataModified, etc., triggered when the underlying DOM structure changes. IE8-Not supported.

Name change event: triggered when element or attribute name changes. Currently deprecated!

As for the basic types of events, with the emergence and development of HTML5, HTML5 events, device events (single touch), touch events, gesture events and other events have been added.

Other events are as follows Resource Event Name When error is triggered Resource load fails. abort Loading resources when they have been aborted. The load resource and its associated resources have finished loading. beforeunloadwindow, document and its resources are about to be unloaded. unload Document or a dependent resource is being unloaded. Web Event Event Name When the online browser has gained web access. offline browser has lost network access. WebSocket event name When to trigger openWebSocket connection established. message A message was received via WebSocket. errorWebSocket connection closed abnormally (e.g. some data could not be sent). closeWebSocket connection closed. CSS animation event name When to trigger animationstart Triggered when a CSS animation starts. animationend Triggers when a CSS animation is complete. AnimationIteration Triggers when a CSS animation finishes and restarts. CSS Transition Event Event Name When to trigger transitionstart

Triggers at the start of a listening transition event.

transitionrun

Triggered when listening for transition events.

transitionend

Triggers at the end of a listening transition event.

Print event Event name Triggers when beforeprint printer is ready. Triggered when afterprint printer is turned off. clipboard event event name when trigger cut text content that has been selected and copied to clipboard. copy has copied the selected text to the clipboard. paste Text content copied from the clipboard is pasted. Thank you for reading! About "javascript event object what is the meaning of this article to share here, I hope the above content can be of some help to everyone, so that we can learn more knowledge, if you think the article is good, you can share it to let more people see it!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report