Fork me on GitHub

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>

 

posted on 2015-01-04 13:32  雨为我停  阅读(199)  评论(0编辑  收藏  举报