Bubble 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:
]
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
[Ctrl A Select all Note:
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 ]