---
title: "鼠标右键屏蔽"
author: "cary"
date: "2007-01-27T10:48:01Z"
tags: []
slug: "untitled"
draft: false
lastmod: "2007-01-27T10:48:01Z"
id: 50788
url: "https://cary.iteye.com/blog/50788"
---

在网上搜了很多文章，试用了下。  
结果：只有下面这能用  
&lt;script language="JavaScript"&gt;  
&lt;!--  
   
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  
//--&gt;  
&lt;/script&gt;

其他的什么　oncontextmenu="window.event.returnvalue=false"　　&lt;body  oncontextmenu="return false"&gt;&lt;/body&gt;都不行。