FFan丶Blog / 部分JS效果 / / JS屏蔽右键、复制、粘贴、剪切

JS屏蔽右键、复制、粘贴、剪切

分类:部分JS效果 发布时间:2021-10-20 09:00:32来源:FFan丶Blog
//屏蔽右键菜单 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")) {...

//屏蔽右键菜单

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;

  }


//屏蔽粘贴

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;

  }

}


//屏蔽复制

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;

  }

}


//屏蔽剪切

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;

  }

}


//屏蔽选中

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;

  }

}

猜你喜欢

  • 根目录新建.htaccess文件 DirectoryIndex index.html index.php

    SEO2020-01-15
  • 以下是以 m.二级域名绑定到子目录/m/为例的.htaccess代码. <IfModule mod_rewrite.c>

    SEO2020-01-15
  • 根目录新建.htaccess文件 RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} !^www\\. RewriteCond %{HTTP_HOST} !^$

    SEO2020-01-15
  • 一、PC站所有页面跳转同一手机页面 function is_mobile() { var regex_match = /(nokia|iphone|android|motorola|^mot-|softbank|foma|docomo|kddi|up.browser|up.link|htc|dopod|blazer|netfront|helio|hosin|huawei|novarra|CoolPad|webos|techfaith|palmsource|blackberry|alcatel|amoi|ktouch|nexian|samsung|^sam-|s[cg]h|^lge|ericsson|philips|sagem|wellcom|bunjalloo|maui|symbian|smartphone|midp|wap|phone|windows ce|

    部分JS效果2020-01-15
  • 快速把excel合并在一起,方便分析和统计可以利用excel表的宏计算就可以实现。方法如下: 1、我们需要把多个excel表都放在同一个文件夹里面,并在这个文件夹里面新建一个excel。

    其他2020-01-15