javascript事件传播(三)

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>event</title>
    <style>
        #big {
            width: 100px;
            height: 100px;
            background-color: #f00;
        }

         #small {
            width: 50px;
            height: 50px;
            background-color: #ccc;
        }


    </style>
</head>
<body>
    <div id="big">
        <div id="small"></div>
    </div>

    <script>
        var big = document.getElementById('big');
        var small = document.getElementById('small');
        big.addEventListener('click', function() {
            alert('big');
        }, false);


       small.addEventListener('click', function(event) {
            event.stopPropagation(); //停止冒泡
            alert('small');
        }, false);

    </script>
</body>
</html>