你可以在 onmousexxx 触发的函数加一个 alert 你会发现:在菜单内移动也会触发~ 这是由于 JS 事件冒泡造成的~ 给你一个思路~ 
在 onmousexxx 函数前都加一个判断:判断现在的层是否位于菜单下面,如果是就退出,这样就能避免闪动问题~

解决方案 »

  1.   

    我试了一下,发现出现问题的是
    <div id="Layer2" style="FILTER: alpha(opacity=0)" onmouseout="low(this)">
    这段代码上,我把鼠标移动在这个层上很容易触发onmouseout事件
    这是为什么
      

  2.   

    css没给出来啊。并说明是哪个浏览器出现问题。
      

  3.   

    css是这个#Layer1 {
    position:absolute;
    left:158px;
    top:185px;
    width:60px;
    height:60px;
    z-index:1;
    border-style:Double;
    border-color:#993300;
    border:3px;
    }
    #Layer2 {
    position:absolute;
    left:316px;
    top:190px;
    width:60px;
    height:60px;
    z-index:auto;
    border-style:Double;
    border-color:#993300;
    border:3px;
    }
      

  4.   

    现在是我把鼠标移动到文字上再移开这个层也会触发onmouseout事件
    这几个层都不会叠层放置,应该不存在上层和下层吧
      

  5.   

    这个代码很差劲。主要解决问题:
    1.原代码基本没有考虑ie之外的浏览器。多处加 document.all 区分ie 浏览器和标准浏览器。2.Lay.style.left = event.x-event.offsetX+72 这一行无用已经注释。initLayer() showLayer() obj参数无用,已经去掉3.border-style:Double; 不是标准,换掉了。4.过程中,对隐藏单位设置 style.display = 'none' 可以解决很多麻烦。5.clearInterval(lowing), clearInterval(highing)增加多处。6.对Layer1 Layer2 增加onmouseover="initLayer()"7.原 initLayer 里的循环没有判断是否存在对象。这个会报js错误的,现已修改。8.建议gif图换成了jpg图。这个不是大问题。如果你用会动的gif,则每次gif动都会触发onmouseover事件。#Layer1 {
        position:absolute;
        left:158px;
        top:185px;
        width:60px;
        height:60px;
        z-index:1;
        border:1px solid #f00;

    }
    #Layer2 {
        position:absolute;
        left:316px;
        top:190px;
        width:60px;
        height:60px;
        z-index:auto;
        border:1px solid #f00;
    }function changeimg(obj,num){
        //initLayer(num);
        var nums;
        nums=getnums(num);
            //鼠标移动上来替换提片
        obj.src="images/banner2_"+nums+".gif";
            //初始化子菜单
        initLayer(num);
                
    }//还原原图
    function recover(obj,num){
        var nums;
        nums=getnums(num);
        obj.src="images/banner_"+nums+".gif";
    }//计算图片名称    
    function getnums(num){
        var nums
        nums=num*2+1;
        if (nums<10){nums="0"+nums}
        return nums;
    }//初始化子菜单
    function initLayer(num){  
      if (window.highing) clearInterval(highing);
      var i=1;            
      while (i<5){
        if (num!=i){
          //如果子菜单不属于触发图片则隐藏
      if(document.getElementById("Layer"+i)){
       
    hideLayer(document.getElementById("Layer"+i))
      }
        }
        else{
          //否则显示子菜单
      if(document.getElementById("Layer"+i)){
     
    showLayer(document.getElementById("Layer"+i))
      }
        }
        i++;
      }
     
      //high(document.getElementById("Layer"+num));
    }//隐藏子菜单
    function hideLayer(Lay){
      if(document.all){
      Lay.filters.alpha.opacity=0;
      }else{
      Lay.style.opacity = 0;
      }
      Lay.style.display = 'none'
    }//显示子菜单
    function showLayer(Lay){
      //Lay.style.left = event.x-event.offsetX+72 + 'px'
      high(Lay);
    }//渐变显示子菜单        
    function high(imgobj){
      if (window.lowing)   clearInterval(lowing);
      theobject=imgobj;
      imgobj.style.display = '';
      highing=setInterval("highit(theobject)",10);
    }//渐变隐藏子菜单
    function low(imgobj){
      if (window.highing) clearInterval(highing);
      theobject=imgobj;
      lowing=setInterval("lowit(theobject)",10);
    } //高亮代码
    function highit(pic){
      if (window.lowing)   clearInterval(lowing);
      if(document.all){
      if (pic.filters.alpha.opacity<100)   
     pic.filters.alpha.opacity+=5;
      else if (window.highing){     
    window.clearInterval(highing);

      }
      }else{      
          
      if (pic.style.opacity<1){        
     pic.style.opacity =  parseFloat(pic.style.opacity) + 0.05;
      }
      else if (window.highing)
    window.clearInterval(highing);
      }
    }     
    function lowit(pic){
      
      if (window.highing) clearInterval(highing);
      if(document.all){
      if (pic.filters.alpha.opacity>0){
    pic.filters.alpha.opacity-=5;
      }else if (window.lowing){
    window.clearInterval(lowing);
    pic.style.display = 'none'
      }
      }else{
      if (pic.style.opacity>0)
    pic.style.opacity = parseFloat(pic.style.opacity) - .05;
      else if (window.lowing){
    window.clearInterval(lowing);
    pic.style.display = 'none'
      }
      }
    }<div id="Layer1" style="FILTER: alpha(opacity=0);opacity:0;display:none;" onmouseover="initLayer(1)"onmouseout="low(this)">
            <table width="100%" height="60" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td class="whitetext"><span class="c2">123</span></td>
              </tr>
            </table>
        </div>
       <div id="Layer2" style="FILTER: alpha(opacity=0);opacity:0;display:none;" onmouseover="initLayer(2)" onmouseout="low(this)">
            <table width="100%" height="60" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td class="whitetext"><span class="c2">234</span></td>
              </tr>
            </table>
       </div>
        <img src="images/banner_03.gif" width="90" height="97" alt="" onmouseover="changeimg(this,1)"  onmouseout="recover(this,1)">
        <img src="images/banner_05.gif" width="90" height="97" alt="" onmouseover="changeimg(this,2)" onmouseout="recover(this,2)">