zoukankan      html  css  js  c++  java
  • 利用js代码屏蔽f12,右键,粘贴,复制,剪切,选中,操作!!秀!秀!秀!

    koala 专注于个人技术分享

    屏蔽f12审查

    <script>
    document.onkeydown = function () {
    if (window.event && window.event.keyCode == 123) {
    alert("F12被禁用");
    event.keyCode = 0;
    event.returnValue = false;
    }
    if (window.event && window.event.keyCode == 13) {
    window.event.keyCode = 505;
    }
    if (window.event && window.event.keyCode == 8) {
    alert(str + "
    请使用Del键进行字符的删除操作!");
    window.event.returnValue = false;
    }
    }
    </script>
    

      

    屏蔽右键菜单

    <script>
    document.oncontextmenu = function (event) {
    if (window.event) {
    event = window.event;
    }
    try {
    var the = event.srcElement;
    if (!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")) {
    return false;
    }
    return true;
    } catch (e) {
    return false;
    }
    }
    
    </script>
    

      

    屏蔽粘贴

    <script>
    document.onpaste = function (event) {
    if (window.event) {
    event = window.event;
    }
    try {
    var the = event.srcElement;
    if (!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")) {
    return false;
    }
    return true;
    } catch (e) {
    return false;
    }
    }
    </script>
    

      

    屏蔽复制

    <script>
    document.oncopy = function (event) {
    if (window.event) {
    event = window.event;
    }
    try {
    var the = event.srcElement;
    if (!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")) {
    return false;
    }
    return true;
    } catch (e) {
    return false;
    }
    }
    </script>
    

      

    屏蔽剪切

    <script>
    document.oncut = function (event) {
    if (window.event) {
    event = window.event;
    }
    try {
    var the = event.srcElement;
    if (!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")) {
    return false;
    }
    return true;
    } catch (e) {
    return false;
    }
    }<script>
    

      

    屏蔽选中

    <script>
    document.onselectstart = function (event) {
    if (window.event) {
    event = window.event;
    }
    try {
    var the = event.srcElement;
    if (!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")) {
    return false;
    }
    return true;
    } catch (e) {
    return false;
    }
    }
    </script>
    

      

    这些代码获取你在某些特殊开发的场合你可以用到,但是你也只能用这个骗一下小白,哈哈! 我收藏的分享出来给大家!

  • 相关阅读:
    反向传播错漏百出小推导
    使用git遇到的
    Cost Function in Logistic Regression and Neural Network
    鼠标左键长按功能的实现
    同类控件的统一操作(以TCHECKBOX为例)
    HLP帮助文件源文件RTF文件的编写
    FORMAT 的用法
    DELPHI6中DSGNINTF.DCU找不到时的解决方法
    使窗体处于可“移动”,可改变“大小”状态中
    系统菜单的控制,使菜单项灰显及恢复功能
  • 原文地址:https://www.cnblogs.com/well-666/p/11530886.html
Copyright © 2011-2022 走看看