日期:2014-05-16 浏览次数:20394 次
<div onclick="alert('div')">
<p onclick="alert('p111')">abcdefg</p>
<br/>
<p onclick="alert('p222')">pppp</p>
</div>
<div onclick="fun('div',event)">
<p onclick="fun('p111',event)">abcdefg</p>
<br/>
<p onclick="fun('p222',event)">pppp</p>
</div>
<script type="text/javascript">
function fun(str,e){
e = e
------解决方案--------------------
window.event;
e.stopPropagation ? e.stopPropagation() : e.cancelBubble = true;//阻止冒泡
alert(str);
}
</script>