阻止冒泡:1、stopPropagation()对于非IE浏览器。2、cancelBubble属性为true,对于IE浏览器, 而Jquery已经有兼容浏览器的方法,event.stopImmediatePropagation(); 复制代码 代码如下: <BR>body <BR> { <BR>background:black; <BR> } <BR>#myDiv <BR> { <BR>background: #fff; <BR>width:250px; <BR>height:250px; <BR>display:none; <BR> } <BR> This is a div; <BR> var myDiv = $("#myDiv"); <BR>$(function () { <BR>$("#btn").click(function (event) { <BR>showDiv();//调用显示DIV方法 <BR>$(document).one("click", function () {//对document绑定一个影藏Div方法 <BR>$(myDiv).hide(); <BR>}); <BR>event.stopPropagation();//阻止事件向上冒泡 <BR>}); <BR>$(myDiv).click(function (event) { <BR>event.stopPropagation();//阻止事件向上冒泡 <BR>}); <BR>}); <BR> function showDiv() { <BR>$(myDiv).fadeIn(); <BR>} <BR>