<script language=javascript> 
function click(){if (event.button==2)alert("禁止使用右键:)!!")}document.onmousedown=click;</script>

解决方案 »

  1.   

    <body oncontextmenu=self.event.returnValue=false>
      

  2.   

    <body oncontextmenu="return false">
      

  3.   

    IE5.0 或者更高就支持这个事件了。。   oncontextmenu="return false"
    用上面提到的第一个方法不能彻底达到效果,
    用户可以使用键盘上的右键做到其实源代码做不到完全保密的,
    使用 ctrl+N  就可以在新窗口里面打开,查看--》原代码
      

  4.   

     ctrl+N 也是可以封锁的!!!happybug.myrice.com进入以后!!是个全屏!!禁止右键和 ctrl+N  不过 也有突破的地方!!
      

  5.   

    <html>
    <head>
    <META http-equiv="Content-Type" content="text/html; charset=gb2312">
    </head>
    <body>
    <SCRIPT language=JavaScript1.2>
    if (window.Event)
      document.captureEvents(Event.MOUSEUP);
    function norightclick(e)
    {
    if (window.Event)
    {
    if (e.which == 2 || e.which == 3)
    {
    alert("您按了右键!!")
    return false;
    }
    else
    alert("您按了左键!!")
    }
    else
    {
    if (event.button == 2 || event.button == 3)
    alert("您按了右键!!")
    else
    alert("您按了左键!!")
    }
    }
    document.onmousedown = norightclick;
    </SCRIPT>
    右键的完整代码!支持IE NN!!!
    </body>
    </html>
      

  6.   

    <script language="JavaScript">
    <!--
     
    if (window.Event) 
      document.captureEvents(Event.MOUSEUP); 
     
    function nocontextmenu() 
    {
     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;
      }
     
    }
     
    document.oncontextmenu = nocontextmenu;  // for IE5+
    document.onmousedown = norightclick;  // for all others
    //-->
    </script>
    这个可以使鼠标右键一点反应也没有
      

  7.   

    只要像下面这样就可以了
    <BODY oncontextmenu="return false" onselectstart="return false" 
    ondragstart="return false">
    右键时会一点反应都没有