码迷,mamicode.com
首页 > 其他好文 > 详细

时间冒泡

时间:2017-03-10 10:51:59      阅读:127      评论:0      收藏:0      [点我收藏+]

标签:back   over   var   doc   div   tle   css   idt   alert   

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
#box{
width: 100%;
height: 600px;
background: red;
overflow: hidden;
}
#box1{
width: 80%;
height: 400px;
margin: 100px auto;
background: blue;
overflow: hidden;
}
#box2{
width: 60%;
height: 200px;
margin: 100px auto;
background: yellow;
}
</style>
</head>
<body>
<div id="box">
<div id="box1">
<div id="box2">

</div>
</div>
</div>
<script type="text/javascript">
var box = document.getElementById("box")
var box1 = document.getElementById("box1")
var box2 = document.getElementById("box2")
document.onclick = fn;
box.onclick =fn;
box1.onclick =fn;
box2.onclick =fn;
function fn ( ev ){
ev = ev|| event;
//ev.cancelBubble = true;
alert(this.id)
}
</script>
</body>
</html>

时间冒泡

标签:back   over   var   doc   div   tle   css   idt   alert   

原文地址:http://www.cnblogs.com/zzgyq/p/6529274.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!