我做了一个treeview,通过右击菜单连接到不同页面,就像电脑的资源管理器一样。但是那个右击菜单在右边的页面中不能保持在最上层。就是在那个边界上就被挡住了,如何才能让右键菜单始终保持在最上层呢??我用的连接的页面语句parent.MDIOpen("LINE_bijiao/COMPACT_RZ.aspx?ID="+ID+"&&HEAD_BUSID="+HEAD_BUSID+"&&END_BUSID="+END_BUSID);
显示右键菜单语句 function displayMenu1()   //显示第一级菜单
     {
     whichDiv=event.srcElement;
      whichname=whichDiv.name;
    //document.getElementById("text1").innerText=whichname;
     if(frontmenuitemid!="")//如果再次显示一级菜单,将其菜单项背景改为白色
     {
         parentitem=document.getElementById(frontmenuitemid);
         parentitem.style.backgroundColor="#ffffff";//改变div背景颜色
         parentitem.style.color="#000000"; //改变字体颜色
     
     }
如何才能让右键菜单始终保持在最上层呢??

解决方案 »

  1.   

    主要思想.用iframe托住你那个div function adjustiFrame(){    // 如果没有IFrame,则创建之    if (!document.getElementById("ifName"))    {        var newNode = document.createElement("iFrame");        newNode.setAttribute("id", "ifName");        newNode.setAttribute("src", "javascript:false;");        newNode.setAttribute("scrolling", "no");        newNode.setAttribute("frameborder", "0");        document.body.appendChild(newNode);    }     iFrameDiv = document.getElementById("ifName");    var div = document.getElementById("alertFram");     // 调整IFrame的位置与div重合,并在div的下一层      try    {        iFrameDiv.style.position = "absolute";        iFrameDiv.style.width = div.offsetWidth;        iFrameDiv.style.height = div.offsetHeight;
            
            iFrameDiv.style.marginLeft = div.style.marginLeft;
            
            iFrameDiv.style.marginTop = div.style.marginTop;        iFrameDiv.style.top = div.style.top;        iFrameDiv.style.left = div.style.left;        iFrameDiv.style.zIndex = div.style.zIndex - 1;        //iFrameDiv.style.visibility = div.style.visibility;    }    catch (e)    {    }}