<!-- saved from url=(0022)http://internet.e-mail -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0044)http://lib.yctc.edu.cn/java/20010813/007.txt -->
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="MSHTML 6.00.2800.1276" name=GENERATOR></HEAD>
<BODY>其实右键菜单很简单作者:crolise 发表日期:2001年6月2日 阅读次数:97 
-------------------------------------------------------------------------------- 
实现方法很简单。 不过就是只有一层 
<STYLE>A.menuitem {
COLOR: menutext; TEXT-DECORATION: none
}
A.menuitem:hover {
COLOR: highlighttext; BACKGROUND-COLOR: highlight
}
DIV.contextmenu {
BORDER-RIGHT: 2px outset; BORDER-TOP: 2px outset; Z-INDEX: 999; VISIBILITY: hidden; BORDER-LEFT: 2px outset; BORDER-BOTTOM: 2px outset; POSITION: absolute; BACKGROUND-COLOR: buttonface
}
</STYLE><DIV class=contextmenu id=cmenu><A 
href="http://www.oso.com.cn/">http://www.oso.com.cn/</A><BR><A 
href="http://www.oso.com.cn/">http://www.oso.com.cn/</A><BR><A 
href="http://www.oso.com.cn/">http://www.oso.com.cn/</A><BR><A 
href="http://www.oso.com.cn/">http://www.oso.com.cn/</A><BR></DIV>
<SCRIPT> 
function window.onbeforeunload() 

cmenu.style.visibility="hidden"; 

function document.onclick() 

cmenu.style.visibility="hidden"; 

function document.oncontextmenu() 

var e=event.srcElement; 
var l=event.offsetX;; 
var t=event.offsetY; 
do 

l+=e.offsetLeft; 
t+=e.offsetTop; 
}while(e=e.offsetParent); 
cmenu.style.pixelLeft=l; 
cmenu.style.pixelTop=t; 
cmenu.style.visibility="visible"; 
event.returnValue=false; 

function cmenu.oncontextmenu() 

event.cancelBubble=true; 
event.returnValue=false; 

</SCRIPT>
</BODY></HTML>

解决方案 »

  1.   

    最简单的是:
    document.oncontextmenu = function(){ return false; };
      

  2.   

    感谢楼上老兄的回答,看来我没说清楚,我想说的是我定制的右键菜单能对javaapplet有一定的操作!
      

  3.   

    好象不行哦!
    <BODY bgcolor="White" leftmargin=0 topmargin=0 oncontextmenu="return false">
    在一般的web页面中可以屏蔽右键菜单,但还是屏蔽不了javaapplet的右键菜单