JavaScript Reference/Javascript Properties/cancelBubble

Материал из Web эксперт
Перейти к: навигация, поиск

"cancelBubble" Example

    
<html>
<head>
<script language="JavaScript">
function function1() {
    if (window.event.shiftKey){
        window.event.cancelBubble = true;
    }
    alert(window.event.cancelBubble);
}
</script>
</head>
<body>
<button onclick="function1();">
Click here while pressing the Shift key
</button>
</body>
</html>



"cancelBubble" is applied to

+----------------+--------------------------------------------------------------+
| Applied_To     |event                                                         |
+----------------+--------------------------------------------------------------+



"cancelBubble" Possible Values

Possible Values
true
false        the default



"cancelBubble" Syntax and Note

Note:
Read and write property. 
Sets whether or not the current event stops bubbling through the document hierarchy. 
    
Syntax:
    
window.event.cancelBubble = value