<!DOCTYPE HTML>
<html>
<head>
<title></title>
<meta charset="utf-8">
</head>
<style type="text/css">
div{
width:500px;
height:500px;
background:red;
}
p{
width:200px;
height:200px;
background:blue;
}
</style>
<body>
<div οnclick="show('a')">
<p οnclick="show('b')"></p>
</div>
<script type="text/javascript">
function show(info){
alert(info);
(function cancelBubble(e){
e = e || window.event;
if (e.stopPropagation) {
e.stopPropagation();
}else {
e.cancelBubble = true;
}
})(event)
}
</script>
<!--当然也可以用监听事件方法:addEventListener("cilck",function(e){window.event? window.event.cancelBubble = true : e.stopPropagation();},false )
-->
</body>
</html>