<html><head><title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style>
td     {font-size: 13px}
.menu1 {cursor: default}
</style>
<script language=Javascript>
var menuclass,menutitle;
function document.onmouseover(){
    menuclass = window.event.toElement.className;
    menutitle = window.event.toElement.innerText;  //得到鼠标当前所对应的文字,以便判断是否弹出菜单
    }
function document.onmousedown(){
  var x = window.event.clientX;
  var y = window.event.clientY;
  var x0=document.body.clientWidth;
  var y0=document.body.clientHeight;    if(event.button==2 && (menutitle=="连接一" || menutitle=="连接二")){       
        ie5menu.style.display="";  
        var x1=document.all.ie5menu.clientWidth;
        var y1=document.all.ie5menu.clientHeight;
        ie5menu.style.left = (x0-x-4<x1) ? x-x1-4 : x+2;
        ie5menu.style.top  = (y0-y<y1)   ? y-y1-4 : y;
        //这种位置设置法的好处在于碰到不够宽的时候菜单会真实window菜单一样移位 
        }
    if(event.button==1 && menuclass != "menu1") ie5menu.style.display = "none";
}function jumptoie5(){
  if (event.srcElement.className=="menu1"){
     if (event.srcElement.getAttribute("target")!=null)
        window.open(event.srcElement.url,event.srcElement.getAttribute("target"))
     else
        window.location=event.srcElement.url
     }
  ie5menu.style.display = "none";
  }function mo(tt,st){  //当鼠标经过时会变到的底色与文字颜色
  if (tt=="over"){st.background='highlight';st.color='#FFFFFF';}
  else           {st.background='menu';     st.color='#000000';}
  }
</SCRIPT>
</head>
<body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0  oncontextmenu="window.event.returnValue=false;//取消鼠标右键菜单"
 onkeydown="if(event.keyCode==27)document.all.ie5menu.style.display='none';//ESC键隐藏菜单">
<br><br><br><br>
&nbsp; &nbsp; &nbsp; <a href="http://www.sina.com.cn">连接一</a><br><br>
&nbsp; &nbsp; &nbsp; <a href="http://www.163.com">连接二</a><DIV id=ie5menu style="BACKGROUND: menu; border: 2 outset #FFFFFF;z-index: 12; position: absolute; display: none" onclick="jumptoie5()">
<table border=0 cellspacing=2 cellpadding=1>
<tr><td noWrap class=menu1 onmouseover=mo("over",this.style) onmouseout=mo("out",this.style) url="addGroup.htm" target="main">&nbsp; 添加子组 &nbsp;</td></tr>
<tr><td noWrap class=menu1 onmouseover=mo("over",this.style) onmouseout=mo("out",this.style) url="delGroup.jsp" target="main">&nbsp; 修改该组</td></tr>
<tr><td noWrap class=menu1 onmouseover=mo("over",this.style) onmouseout=mo("out",this.style) url="#">&nbsp; 删除该组</td></tr>
</table></div></body>
</html>

解决方案 »

  1.   

    这种出了边界的菜单,用popup:
    var oPopup = window.createPopup();
    function popUp(file)
    {
      oPopup.document.body.innerHTML="<img id='mypopup' src='"+file+"'></img>";
      oPopup.show(window.screenLeft,window.screenTop,1,1);
      setTimeout('oPopup.show(window.screenLeft,window.screenTop,oPopup.document.all.mypopup.width,oPopup.document.all.mypopup.height);',500);
    }                                                               
    详细的效果,你应该会做的,我想