<body oncontextmenu="return false">
试试看!呵呵

解决方案 »

  1.   

    第一种:最笨的方法
    把下列代码加入到<head>与</head>之间
    <SCRIPT language=javascript>
      function click() {
      if (event.button==2) {
      alert(\''欢迎访问http://www.sobao.com\'')
      }
      }
      document.onmousedown=click
      </SCRIPT>第二种:添加至收藏夹
    <SCRIPT language=JavaScript><!--
    function click() {
    if (event.button==2){window.external.addFavorite(\''http://www.sobao.com\'',\''搜豹网站\'')]
    document.onmousedown=click
    // --></SCRIPT>第三种:使鼠标右键无响应,别人还以为自己的鼠标坏了!
    把<BODY>改成<BODY oncontextmenu=self.event.returnValue=false>第四种:最聪明的方法,自己定制鼠标的右键菜单,给访问者以全新的感受!
    第一步:把代码加入到<head>与</head>之间
    <style>
    <!--
    /*
    Context menu Script-
    c Dynamic Drive
    Last updated: 99/09/16th
    For full source code, 100\''s more DHTML scripts, and Terms Of Use,
    visit dynamicdrive.com
    */
    #ie5menu{
    position:absolute;
    width:200px;
    border:2px solid black;
    background-color:menu;
    font-family:Verdana;
    line-height:20px;
    cursor:default;
    visibility:hidden;
    }
    .menuitems{
    padding-left:15px;
    padding-right:15px;
    }
    -->
    </style>
    <script language="JavaScript1.2">
    //set this variable to 1 if you wish the URLs of the highlighted menuto be displayed in the status bar
    var display_url=0
    function showmenuie5(){
    var rightedge=document.body.clientWidth-event.clientX
    var bottomedge=document.body.clientHeight-event.clientY
    if (rightedge<ie5menu.offsetWidth)
    ie5menu.style.left=document.body.scrollLeft+event.clientX-ie5menu.offsetWidth
    else
    ie5menu.style.left=document.body.scrollLeft+event.clientX
    if (bottomedge>ie5menu.offsetHeight)
    ie5menu.style.top=document.body.scrollTop+event.clientY-ie5menu.offsetHeight
    else
    ie5menu.style.top=document.body.scrollTop+event.clientY
    ie5menu.style.visibility="visible"
    return false
    }
    function hidemenuie5(){
    ie5menu.style.visibility="hidden"
    }
    function highlightie5(){
    if (event.srcElement.className=="menuitems"){
    event.srcElement.style.backgroundColor="highlight"
    event.srcElement.style.color="white"
    if (display_url==1)
    window.status=event.srcElement.url
    }
    }
    function lowlightie5(){
    if (event.srcElement.className=="menuitems"){
    event.srcElement.style.backgroundColor=""
    event.srcElement.style.color="black"
    window.status=\''\''
    }
    }
    function jumptoie5(){
    if (event.srcElement.className=="menuitems")
    window.location=event.srcElement.url
    }
    </script>
    第二步:把下列代码加入到<body>与</body>之间
    <!--[if IE]>
    <div id="ie5menu" onMouseover="highlightie5()"onMouseout="lowlightie5()" onClick="jumptoie5()">
    <div class="menuitems" url="http://www.sobao.com">搜豹网站首页</div>
    <div class="menuitems"url="http://www.sobao.com/internetschool/index.php">搜豹网络学堂</div>
    <div class="menuitems" url="http://woman.sobao.com/index.htm">漂亮女人</div>
    <div class="menuitems"url="http://products.sobao.com/">搜豹产品</div>
    <div class="menuitems"url="http://www.sobao.com/search/">搜豹搜索</div>
    <hr>
    <div class="menuitems" url="http://mail.sobao.com/">搜豹邮箱</div>
    </div>
    <![endif]-->
    <script language="JavaScript1.2">
    document.oncontextmenu=showmenuie5
    if (document.all&&window.print)
    document.body.onclick=hidemenuie5
    </script>
    当然,你也可以不用取消鼠标右键,就看你自己的需要了!
      

  2.   

    我的怎么出不来那个效果啊,好象event.button没有反应啊!是不是跟浏览器有关系啊?请指教。
      

  3.   

    我使用过的方法:
    <BODY oncontextmenu=self.event.returnValue=false>
      

  4.   

    一楼的IE5以上好像是
    二楼的
    在<head></head>之间加入以下代码:<script language="javascript">
    <!--
    function click() 
    {
    if (event.button==2)
    alert('对不起,禁止使用此功能.')
    }
    document.onmousedown=click
    -->
    </script>
      

  5.   

    谢谢大家,现在是让右键屏蔽了,可是我网页上的文本他们还是可以随便copy的啊。他们可以用鼠标左键选中要copy的文本内容,然后按ctrl+c就可以copy网页上的文本了。请问这个问题该怎么解决啊!谢谢先!
      

  6.   

    1. oncontextmenu="window.event.returnvalue=false" 将彻底屏蔽鼠标右键
    <table border oncontextmenu=return(false)><td>no</table> 可用于Table2. <body onselectstart="return false"> 取消选取、防止复制3. onpaste="return false" 不准粘贴4. oncopy="return false;" oncut="return false;" 防止复制