<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style type="text/css">
			#first{
			    width:200px;
			    height:200px;
			    margin:0 auto;
			    background:red;
			    border:1px solid #ccc;
			        }
			#second{
			    width:150px;
			    height:150px;
			    margin:24px auto;
			    background:yellow;
			    border:1px solid #ccc;
			}
			#third{
			    width:100px;
			    height:100px;
			    margin:24px auto;
			    background:blue;
			    border:1px solid #ccc;
			}
		</style>
	</head>
	<body>
		<div id="first">
		    <div id="second">
		        <div id="third"></div>
		    </div>
		</div>
		<script type="text/javascript">
			var first=document.querySelector("#first");
			var second=document.querySelector("#second");
			var third=document.querySelector("#third");
			//第三个参数设为false，将事件处理程序添加到冒泡阶段
			first.addEventListener('click',function(e){
			    var target=e.target;
			    console.log('红色框');
			},false);
			second.addEventListener('click',function(e){
			    var target=e.target;
			    console.log('黄色框');
			},false);
			third.addEventListener('click',function(e){
			    var target=e.target;
			    console.log('蓝色框');
			},false);
		</script>
	</body>
</html>
