jq屏蔽鼠標右鍵複製,粘貼,選中功能

//屏蔽右鍵菜單
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;
  }
}io

 

//屏蔽粘貼
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;
  }
}event

 

//屏蔽複製
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;
  }
}ast

 

//屏蔽剪切
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;
  }
}function

 

//屏蔽選中
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;
  }
}select

相關文章
相關標籤/搜索