是不是当鼠标在层里的图片上时,层的onmouseout已经生效了?

解决方案 »

  1.   

    你把hidenMenu()放到了外面的<div>上,他就会对该区域中所包含的内容起做用.
    所以你要将相应的控制加在包含图片的表示符上,或起所在的<td>.
    这样你在相应的hidenMenu()方法里写不同的控制就ok了,试验一下吧
      

  2.   

    我发现了。我写了一个 st 的 input type=text,并把 hidenMenu改成下面的样子
    function hidenMenu(str){
    st.value='0';
    //str.style.display='none';
    }
    发现,很正常,只要离开div,st才是0。
    但不知道为什么,把//str.style.display='none'; 这句打开,就成了,当鼠标离开第一张图的时候,这个层就没了,为什么
      

  3.   

    当div里包含有其他元素时,IE捕捉onmouseout事件是依靠div包含的子元素的事件传递完成的,也就是通常所说的"冒泡",当鼠标移动到第一张图片的结尾时,该图片产生mouseout事件,然后该事件冒泡传递给div,导致div产生mouseout事件。(如果你没有隐藏层的话,你还可以看到会再产生mouseover事件)解决办法:
    在img上取消事件冒泡,并且是div的边缘与图片边缘有一个小的margin,是div的mouseout事件可以触发
    <style>
    div{background-color:red}
    table,img,td{o:expression(this.onmouseout=function(){event.cancelBubble=true;});margin-left:10px;margin-right:10px;margin-bottom:10px;}
    </style>
    <script>
    function hidenMenu(obj)
    {
      obj.style.display='none';
    }
    </script>
    <body>
    <Div id=divPer OnMouseOut="hidenMenu(this);" Style="position:absolute; z-index:1; display:'none'; width:200px; Top:24px; left:10px; filter:Alpha(opacity=80);">
    <Table Cellspacing=0 Cellpadding=0 Border=0 Width=100%>
    <Tr><Td><Img src="Images/MenuPerFocus.png"></Td></Tr>
    </Table>
    <Table Cellspacing=0 Cellpadding=0 Border=0 Width=100% Background=Images/MenuSubBg.png>
    <Tr Height=5><Td></Td></Tr>
    <Tr><Td><Img src="Images/MenuPerSub1.png"></Td></Tr>
    </Table>
    </Div>
    </body>