js
document.onmousedown=function(e){ var target = e.target; //alert(target.id); var sea = target.getAttribute("sea"); if(sea!="sea"){ if(get("seaList").style.display!="none"){ get("seaList").style.display="none"; } } };
?
jquery
$(document).bind(‘click‘,function(e){ var target = jQuery(e.target); //alert(target.attr("id")); alert(target.closest(".seaVal").length+","+target.closest(".seaList").length); if(target.closest(".seaVal").length!=1&&target.closest(".seaList").length!=1) { if($(".seaList").show()){ $(".seaList").hide(); } } });
?
原文:http://zihai367.iteye.com/blog/2294657