标签:head rip ack body listen get doctype back false
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>事件模型</title>
<style>
#outer{margin: 100px 0 0 100px; width: 200px;height: 200px; background: red;}
#inner{margin-left:20px; width: 50px;height:50px; background: green;}
</style>
</head>
<body>
<div id = ‘outer‘>
<div id="inner"></div>
</div>
<script>
var click = document.getElementById(‘inner‘);
var clickouter = document.getElementById(‘outer‘);
click.addEventListener(‘click‘,function(event){
alert(‘click one‘);
// event.stopPropagation();
event.cancelBubble = true
},false);
clickouter.addEventListener(‘click‘,function(event){
alert(‘click two‘);
},false);
</script>
</body>
</html>
标签:head rip ack body listen get doctype back false
原文地址:http://www.cnblogs.com/studyh5/p/7930300.html