直接禁止右键行不行?
<body oncontextmenu="return false;">

解决方案 »

  1.   

    以下程序不仅屏蔽右键,还屏蔽了 刷新 等多个按键,你再改改,效果更好!
    <script language=javascript>
    <!--
    ie4 = (document.all) ? true : false;
    ns4 = (document.layers) ? true : false;
    function keyDown(e)
    {
    if (ns4)
    {var nKey=e.which;
    if (nKey==17) {
    document.write("请勿试图拷贝网页内容");
    window.alert("^_^");
    }
    if (ieKey==116) {
    document.write("对不起,本网页无法刷新");
    window.alert("^_^");
    }
    }
    if (ie4){var ieKey=event.keyCode;
    if (ieKey==17) {
    document.write("请勿试图拷贝网页内容");
    window.alert("^_^");
    }
    if (ieKey==116) {
    document.write("对不起,本网页无法刷新");
    window.alert("^_^");
    }
    }
    }
    document.onkeydown=keyDown;
    if (ns4) document.captureEvents(Event.KEYDOWN);
    //-->
    </script>
      <script language=javascript>
    function click() { if (event.button!=1) {
    document.write("^_^");
    window.alert("^_^");
    }}
    document.onmousedown=click
    </script>
    <SCRIPT language=JavaScript>
    <!--
    function MM_reloadPage(init) {  //reloads the window if Nav4 resized
      if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
        document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
      else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
    }
    MM_reloadPage(true);
    // -->
    </SCRIPT>
    <SCRIPT language=JavaScript>
    <!--
    function click() {
    if(event.button==2){
    window.external.addFavorite('http://www.csdn.net,'中国软件网')
    }
    }
    document.onmousedown=click
    function MM_displayStatusMsg(msgStr) { //v1.0
      status=msgStr;
      document.MM_returnValue = true;
    }
    //-->
    </script>
    </head>
    <body bgcolor="#000000" oncontextmenu=self.event.returnValue=false>
      

  2.   

    <html>
    <head>
    <title禁止使用右键</title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <SCRIPT language=JavaScript>
    <!--
    curPage=1;
    document.oncontextmenu = function(){return false}
    if(document.layers) {
    window.captureEvents(Event.MOUSEDOWN);
    window.onmousedown = function(e){
    if(e.target==document)return false;
    }
    }
    else {
    document.onmousedown = function(){return false}
    }
    //-->
    </SCRIPT>
    </head><body>
    </body>
    </html>
      

  3.   

    to viking(海盗):你的例子好像没有限制刷新啊,不知是不是浏览器的问题,我的是Ie5.0