<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>鼠标右键菜单</title>
    <style type="text/css" >
        #menu{
            position:absolute;
            background-color:#cccccc;
            width:80px;
            visibility:hidden;
        }
    </style>
    <script language="javascript">
        function popmenu(){
            if(event.button==2){
                menu.style.left=event.x;
                menu.style.top=event.y;
                menu.sytle.visibility="visible";
            }
            else if(event.button==1){
                menu.style.visibility="hidden"
            }
        }
        document.onmousedown=popmenu;
    </script>
</head>
<body oncontextmenu="return false">
    
    <div id="menu">
        <a href="#"> 加入书架</a>
        <a href="#"> 给我留言</a>
        <a href="#"> 联系我们</a>
    </div>
   
</body>
</html>
不知道我哪里写错了。 禁止右键菜单【oncontextmenu】 怎么也不管用

解决方案 »

  1.   

       <script type="text/javascript" language="javascript">
            document.oncontextmenu = new Function('event.returnValue=false;');
            document.onselectstart = new Function('event.returnValue=false;');   
        </script>
      

  2.   

    谢谢  jayinIT
    我去试试 。。
      

  3.   

    还是不行啊。我IE 360 Google都试了啊