<HTML>
<HEAD>
<TITLE>鼠标右键将不起作用!!!</TITLE>
<script language="JavaScript1.2"> 
if (window.Event) 
document.captureEvents(Event.MOUSEUP); function nocontextmenu()  
{
Layer1.style.left = event.clientX + document.body.scrollLeft;
Layer1.style.top = event.clientY + document.body.scrollTop;
Layer1.style.visibility = "visible";
event.cancelBubble = true;
event.returnValue = false;
return false;
}function norightclick(e)
{
if (window.Event)
{
if (e.which == 2 || e.which == 3)
return false;
}
else
if (event.button == 2 || event.button == 3)
{
event.cancelBubble = true
event.returnValue = false;
return false;
}
else
if(event.button==1)
{
if(event.srcElement.nodeName=="BODY")
if(Layer1.style.visibility == "visible")
Layer1.style.visibility="hidden";
}
}document.oncontextmenu = nocontextmenu;
document.onmousedown = norightclick;
</script>
</HEAD><BODY BGCOLOR="#FFFFFF">
<div id="Layer1" style="position:absolute; left:0px; top:0px; width:73px; height:73px; z-index:1; visibility: hidden"> 
  <table border="1" cellspacing="1" cellpadding="1" width="100%" bordercolor="#999999">
    <tr>
      <td align="center">新增</td>
    </tr>
    <tr>
      <td align="center">修改</td>
    </tr>
    <tr>
      <td align="center">删除</td>
    </tr>
  </table>
</div>
鼠标右键将不起作用!!! 
</BODY>
</HTML>

解决方案 »

  1.   

    <html>
    <head>
    <style type="text/css">
    .box {
    BACKGROUND:#408080;
     color:#00ffff; FONT: 9pt "宋体"; POSITION: absolute
    }
    </style>
    <title></title>
    </head>
    <script language="JavaScript">
    document.onclick = popUp 
    function popUp() {
    newX = window.event.x + document.body.scrollLeft
    newY = window.event.y + document.body.scrollTop
    menu = document.all.itemopen
      if ( menu.style.display == ""){
        menu.style.display = "none" }
      else {
         menu.style.display = ""}
        menu.style.pixelLeft = newX - 50
        menu.style.pixelTop = newY - 50}
    </script>
    <body>
    <table class="box" id="itemopen" style="DISPLAY: none">
    <tbody>
      <tr>
        <td><a href="hllhhlh"><font color="#ffffff">随意的菜单</font></a></td>
      </tr>
    </tbody>
      <tr>
        <td><font color="#ffffff">hello</font></td>
      </tr>
      <tr>
        <td><font color="#ffffff">这是用单元</font></td>
      </tr>
      <tr>
        <td><font color="#ffffff">格做的,你</font></td>
      </tr>
      <tr>
        <td><font color="#ffffff">也可以加</font></td>
      </tr>
    </table>
    </body>
    </html>