nbsp;html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
阻止JavaScript事件冒泡传递(cancelBubble 、stopPropagation) <script> <BR>function doSomething (obj,evt) { <BR> alert(obj.id); <BR> var e=(evt)?evt:window.event; <BR> if (window.event) { <BR> e.cancelBubble=true; <BR> } else { <BR> //e.preventDefault(); <BR> e.stopPropagation(); <BR> } <BR>} <BR></script>
This is parent1 div.
This is parent1 div.
This is parent2 div.
This is child2. Will bubble.
This is parent2 div.