取消事件传递即可<html> 
<head> 
<title> </title> <script language="javascript"> function show() 

event.cancelBubble = true;
var div2 = document.getElementById("div2"); 
div2.style.display = "block"; 
} function hide() 

var div2 = document.getElementById("div2"); 
div2.style.display = "none"; 
} function begin() 

var div1 = document.getElementById("div1"); 
div1.attachEvent("onclick",show);var bb = document.body; 
bb.attachEvent("onclick",hide); 

</script> </head> <body style="margin:0px;" onload="begin();"> <div id="div1" style="width:30px; height:50px; background-color:#999999;"> </div> 
<div id="div2" style="position:absolute; top: 100px; width:200px; height:50px; background-color:red; display:none;"> </div>  </body> 
</html>