html代码
<div id="detailMsg" class="showDiv" style="margin: 0 0 0 200px;">.... //弹出框内具体内容省略</div>
js代码(引入jquery)
$("#detailMsg").click(function(e){e= e || window.event;if(e.cancelBubble)e.cancelBubble = true;elsee.stopPropagation();});$("body").click(function(){$('#detailMsg').css("display","none"); }); });$(function () {