屏蔽右键和刷新功能

document.onkeydown = function() {
if ((window.event.keyCode==116)|| //屏蔽 F5
 (window.event.keyCode==122)|| //屏蔽 F11
 (window.event.shiftKey && window.event.keyCode==121) //shift+F10
 ) {
  window.event.keyCode=0;
  window.event.returnValue=false;
 }
}
if (window.Event)
 document.captureEvents(Event.MOUSEUP);

document.oncontextmenu = function() {
 window.event.cancelBubble = true;
 window.event.returnValue = false;
 return false;
};
document.onmousedown = function() {
 if (window.event.button == 2 || window.event.button == 3){
  window.event.cancelBubble = true;
  window.event.returnValue = false;
  return false;
 }
 return true;

你可能感兴趣的:(屏蔽右键和刷新功能)