上面例子我有两个问题:
1。在击右键菜单时,window的菜单也出现,怎么禁止?
2。现在我想把down(tid,gid)中参数传到添加子组、删除改组和修改组等这些连接中,问怎么传递参数?急盼解

解决方案 »

  1.   

    http://go6.163.com/colorweb/xml/xmlcontextmenu.html
      

  2.   

    <!-- 时间较紧,改得仓促! -->
    <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>
      

  3.   

    谢谢meizz(梅花雨)!不过我可能还有问题,先结贴再说吧