


js bubbling events and event listening usage analysis_javascript skills
May 16, 2016 pm 06:45 PMBubble event
"Bubble event (bubble)" in js is not a fancy trick that can be used in practice. It is a mechanism for executing the sequence of js events. "Bubble algorithm" is a classic problem in programming. The "bubble" in the bubble algorithm should be said to be exchange more accurately; the "bubble event" in js is the true meaning of "bubble". It traverses the tree layer by layer from the lowest level of the DOM, and then attaches the corresponding events. Take the following code as an example:
[Ctrl A Select all Note: If you need to introduce external Js, you need to refresh to execute
View the running effect
Event monitoring
To be precise, event monitoring can be said to be the operation of the js engine to monitor the user's mouse, keyboard, window events and other actions, that is, to attach events to the user's corresponding operations. Commonly used ones are similar to btnAdd.onclick=" alert('51obj.cn')" is a simple attached event, but this method does not support attaching multiple events and deleting events. The following code will implement deletion of events after attaching events (under IE): If you need to introduce external Js, you need to refresh to execute
]
View the running results
Click
If you need to introduce external Js, you need to refresh to execute
]
[Ctrl A select all Note: If you need to introduce external Js, you need to refresh to execute ]

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Implement map event monitoring function using JavaScript and Tencent Maps

No support for bubbling events: limitations and scope

How to effectively prevent events from bubbling up

Master the common event bubbling mechanism in JavaScript

Master the importance of bubbling events and enhance personal social skills

What is the meaning of bubbling events
