Home  >  Article  >  Web Front-end  >  IE event delivery-event.cancelBubble example introduction_javascript skills

IE event delivery-event.cancelBubble example introduction_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:04:081214browse

Regarding event.cancelBubble, since objects in HTML are hierarchical structures, for example, a Table contains multiple TRs, and a TR contains multiple TDs
Bubble is an event that can be passed from child nodes to parent nodes, such as mouse clicks. A TD is created, and the current event.srcElement is this TD. However, this bubbling mechanism allows you to intercept the click event from TR or Table, but if you event.cancelBubble, the event cannot be uploaded.
Example:

Copy code The code is as follows:








< td width="106">Block message upload

General

 







event.cancelBubble prevents event bubbling, event.cancelBubble=true;

Cancels event bubbling, in IE In the event mechanism, the triggering event will be uploaded step by step from the child element to the parent element. That is to say, if the child element triggers a click event, the click event of the parent element will also be triggered; event.cancelBubble=true; can stop the event from continuing. Upload to add that Ie's event delivery is from bottom to top:
Statement:
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