做了个例子,不知道是不是lz想要的效果:<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>new page</title>
<script>
var out;
function a(){
div1.style.display="none";
}
function show_div(){
div1.style.display="block";
}
function smalldiv(){
out=window.setTimeout("a()",10);
if(event.srcElement.id!="div1")
event.srcElement.style.backgroundColor="#cccccc";
}
function overdiv(){
window.clearTimeout(out);
if(event.srcElement.id!="div1")
event.srcElement.style.backgroundColor="#aaaaaa";
}
</script>
</head>
<body>
<div id=div1 style="width:200px;height:210px;background-color:#cccccc;display:none" onMouseOut="smalldiv()" onMouseOver="overdiv()">
<div style="border:1px solid blue;width:100%;height:30px;" id="menu1"></div>
<div style="border:1px solid blue;width:100%;height:30px;" id="menu2"></div>
</div>
<input type=button id=btn1 value="显示div" onclick="show_div()">
</body>
</html>

解决方案 »

  1.   

    IE下可以用:
    <div style="width:200px;height:210px;" onMouseOut="smalldiv()">
    --->>>
    <div style="width:200px;height:210px;" onmouseleave="smalldiv()">
      

  2.   

    to:JK_10000(JK)
    你测过吗?什么效果?我怎么看不出来?.......
      

  3.   

    这样固然会exec smalldiv() 了
      

  4.   

    鼠标从父元素移到子元素,会触发父元素的onmouseout事件~~~~
      

  5.   

    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>new page</title>
    <script>
    function a(){
    div1.style.display="none";
    }
    function show_div(){
    div1.style.display="block";
    }
    function smalldiv(){
    if(event.toElement&&event.toElement.tagName!="DIV")
    a();
    }
    function overdiv(obj){
    obj.style.backgroundColor="#aaaaaa";
    }
    </script>
    </head>
    <body>
    <input type=button id=btn1 value="显示div" onclick="show_div()">
    <div id=div1 style="width:200px;height:210px;background-color:#cccccc;display:none" onMouseOut="smalldiv()">
    <div style="border:1px solid blue;width:100%;height:30px;" id="menu1" onMouseOver="overdiv(this)" onmouseout="window.event.cancelBubble = true;this.style.backgroundColor='#cccccc'"></div>
    <div style="border:1px solid blue;width:100%;height:30px;" id="menu2" onMouseOver="overdiv(this)" onmouseout="window.event.cancelBubble = true;this.style.backgroundColor='#cccccc'"></div>
    </div>
    </body>
    </html>
      

  6.   

    上面有误,将window.event.cancelBubble = true;去掉