XML DOM property ng kaganapan

Panlalagay at paggamit

Ang halaga ng property ng bubbles ng kaganapan ay isang boolean, kung ang kaganapan ay isang uri ng bubbling, ang halaga ay true, kung hindi, ang halaga ay false.

Panlalagay at paggamit

event.bubbles

Pagpapasok ng kaganapan

Sa 2 na antas ng DOM, ang pagpapasok ng kaganapan ay nahahati sa tatlong yugto:

First, the capture phase. The event starts from Document objectalong the document tree to the target node. If any of the target's ancestors have specifically registered a capture event handler, then these handlers will run during the event propagation process.

The second phase occurs on the target node itself. Directly registering an event handler on the target will run. This is similar to the event handling method provided by the 0-level event model.

Third, the bubbling phase. At this stage, the event will propagate back up from the target element or bubble back Document objectof the document hierarchy.

Example

The following example can detect whether the event that occurs is a bubbling event:

<html>
<head>
<script type="text/javascript">
function getEventType(event)
  { 
  alert(event.bubbles);
  }
</script>
</head>
<body onmousedown="getEventType(event)">
<p>Click somewhere in the document. 
An alert box will tell if the event is a bubbling event.</p>
</body>
</html>

TIY

bubbling event
ពិនិត្យថាឧបហេតុនេះគឺជាឧបហេតុកើតឡើងដោយការផ្សព្វផ្សាយ (IE ការអ្នកមើលគេហទំព័រមិនគាំទ្រ)。