Get event Phase: CAPTURING,BUBBLING : Event Properties « Event « JavaScript DHTML






Get event Phase: CAPTURING,BUBBLING

  


<html> 

<head> 
<title>W3C DOM Event Propagation</title> 
<script type="text/javascript"> 


function getPhase(evt) { 
    switch (evt.eventPhase) { 
        case 1: 
        return "CAPTURING"; 
            break; 
        case 2: 
        return "AT TARGET"; 
            break; 
        case 3: 
        return "BUBBLING"; 
            break; 
        default: 
        return ""; 
    } 
} 
</script> 
</head> 
<body onload="init()"> 
<form> 
<input type="button" value="Button 'main1'" name="main1" onclick="alert('button (' + getPhase(event) + ').')" /> 
</form> 
</body> 
</html> 

   
    
  








Related examples in the same category

1.Event qualifier
2.Event saveType
3.Event nextPage
4.Event repeat
5.Event return Value
6.Event pageY and pageX
7.Event screenY, screenX
8.Event offsetY and offsetY
9.Event 'layerY'
10.Event 'layerX'
11.Event 'propertyName'
12.Event from Element
13.Event screenX
14.Event 'target' Example
15.Event 'srcUrn' Example
16.Event source element
17.Event to Element
18.Event type
19.Event y and x Property
20.'contentOverflow' Example
21.'cancelBubble' Example