<html>
<head>
<body>
<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>
点右键看看啊
</body>
</html>

解决方案 »

  1.   


    if (document.getElementById("imb_Background")==null){ 
                    document.body.innerHTML += " <iframe id=\"imb_Background\" src=\"about:blank\" style=\"position:absolute;left:0;top:0;width:0px;height:0px;visibility:hidden;\" frameborder=\"0\"> </iframe>"; 
                    window.imb_Background.document.open(); 
                    window.imb_Background.document.write(" <html><head>script>
    function disabled(){document.oncontextmenu = new Function("event.returnValue=false;");
    }</script></head> <body onload="disabled()" bgcolor=red>&nbsp;sdfasdfasdf </body> </html>"); 
                    window.imb_Background.document.close(); 
                } 
                if (document.getElementById("imb_FormModal")==null){ 
                    document.body.innerHTML += " <iframe id=\"imb_FormModal\" src=\"about:blank\" style=\"position:absolute;left:0;top:0;width:0px;height:0px;visibility:hidden;border-bottom:2px solid #999999;border-right:2px solid #999999;border-top:1px solid #F8F6C1;border-left:1px solid #F8F6C1;\" frameborder=\"0\"> </iframe>"; 
                    window.imb_FormModal.document.open(); 
                    window.imb_FormModal.document.write(" <html> <head> <script>
    function disabled(){document.oncontextmenu = new Function("event.returnValue=false;");
    }</script><style> <!--"); 
                    window.imb_FormModal.document.write("td{font-size:12px;"); 
                    window.imb_FormModal.document.write("//--> </style> </head> <body onload="disabled()" scroll=no leftmargin=0 topmargin=0 oncontextmenu='return false'>"); 
                    window.imb_FormModal.document.write(" <table width=100% height=100% bgcolor=\"#eeeeee\"> <tr> <td  align=left bgcolor=red> <div id=\"imb_Title\" style=\"padding-left:3px;padding-right:3px;color:white;font-family:verdana;\">"); 
                    window.imb_FormModal.document.write(" </div> </td> </tr> <tr> <td align=left> <div id=\"imb_Content\" style=\"padding:7px;\">"); 
                    window.imb_FormModal.document.write(" </div> </td> </tr> <tr> <td id=\"imb_Body\" align=center>"); 
                    window.imb_FormModal.document.write(" </td> </tr> </table>"); 
                    window.imb_FormModal.document.write(" </body> </html>"); 
                    window.imb_FormModal.document.close(); 
                }试试上边的。
      

  2.   


    <!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>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    <script language="javascript">
    function StopRightButton()
    {
    if(document.all)
    {
    this.IContextMenuHander = function(){return false;};
    document.attachEvent("oncontextmenu", this.IContextMenuHander);
    }
    else
    {
    this.IContextMenuHander = document.oncontextmenu;
    document.oncontextmenu = function(){return false;}
    }
    }
    </script>
    </head>
    <body onload="StopRightButton()">
    <div id="as" style="width:600px;height:400px;background:#00FF99;"></div>
    </body>
    </html>