轉自http://qiaolevip.iteye.com/blog/2087911
- <div style="width:100px; height:100px; border:1px solid #000" id="x">
- <div style="width:50px; height:50px; margin:0 auto; border:1px solid #ccc" id="y"></div>
- </div>
- <script type="text/javascript">
- document.getElementById("x").οnclick=function(e)
- {
- alert("x")
- e = e || window.event;
- if (e.stopPropagation )
- e.stopPropagation();
- else
- e.cancelBubble = true;
- }
- document.getElementById("y").οnclick=function(e)
- {
- alert("y")
- e = e || window.event;
- if (e.stopPropagation )
- e.stopPropagation();
- else
- e.cancelBubble = true;
- }
- </script>
最后
以上就是谦让心锁最近收集整理的关于Div嵌套防止穿透事件的全部内容,更多相关Div嵌套防止穿透事件内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复