js冒泡排序

点击Demo

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
    </head>
    <body>
        <div id="div" onclick="alert(2);">
            <input type="button"  id="btn"  value="点击" onclick="alert(1);stopBubble(this);"/>
        </div>
    </body>
    <script src="http://code.jquery.com/jquery.js"></script>
    <script>
         function stopBubble(e) 
         { 
             if (e && e.stopPropagation) 
                 e.stopPropagation();
             else 
                 window.event.cancelBubble=true ;

         } 
        
    </script>
</html>
原文地址:https://www.cnblogs.com/wanliyuan/p/4200907.html