js事件的冒泡和捕获在编程中有什么用?
如题..
------解决方案--------------------LZ 写的代码少,等代码写多了自然就会用到了!   
 写个小例子,L@_@K!   
   <body>  
    <div id= "divParent " style= "background-color: #ffff00; width: 200px; height: 200px; "> Parent! 
      <div id= "divChild " style= "background-color: #00ffff; width: 100px; height: 100px; ">  
         Child! 
      </div>  
    </div>  
    <script type= "text/javascript ">  
    <!-- 
 var oParent = document.getElementById( "divParent "); 
 var oChild = document.getElementById( "divChild "); 
 oParent.onclick = function() 
 { 
     alert( "Parent "); 
 }; 
 oChild.onclick = function() 
 { 
     alert( "Child "); 
     // 停止冒泡! 
     // 注释看看效果有何不同! 
     event.cancelBubble = true; 
 }; 
   //-->  
    </script>  
   </body>