<!DOCTYPE html>
<html lang="en">
<head>
<title>Title</title>
<meta charset="UTF-8">
<!--<!– <script src="js_file01.js"></script>–> 尽量放后body前边-->
<style>
#id1{
width: 200px;
height: 100px;
background-color: #178cfa;
}
#id2{
width: 50px;
height: 50px;
background-color: #fac237;
}
</style>
</head>
<body>
<div id="id1" onclick="alert('id1')">
<div id="id2" onclick="func2(event)"></div>
<!-- // 事件延申-->
</div>
<script>
function func2(e) {
alert("id1");
e.stopPropagation(); // 阻止 事件延申
}
</script>
</body>
</html>