• js屏蔽浏览器(IE和FireFox)的刷新和右键等功能


    //一、js屏蔽浏览器(IE和FireFox)的刷新功能
    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.altKey)&&(window.event.keyCode==115)){ //屏蔽Alt+F4
        window.showModelessDialog("about:blank","","dialogWidth:1px;dialogheight:1px");
        return false;
      }
    }
    二、屏蔽右键
    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
      document.oncontextmenu = function(){return false;} // 只用这一句达到效果

  • 相关阅读:
    vagrant 入门3
    vagrant 入门4
    vagrant 入门2
    Map、Debug追踪
    Comparator比较器 、Comparable接口
    File类
    Lambda表达式、函数式编程思想概述
    异常--异常体系、异常的处理、异常的捕获、finally语句块和自定义异常
    List集合、Set集合、Collection集合工具类
    数据结构---栈、队列、数组、链表和红黑树
  • 原文地址:https://www.cnblogs.com/DellHome/p/5072387.html
Copyright © 2020-2023  润新知