功能:

  1. 禁止使用右鍵來複製內容
  2. 禁止使用瀏覽器選單的複製和全選來複製內容
  3. 禁止使用滑鼠選擇內容
  4. 禁止使用Ctrl+A來全選
  5. 禁止使用Ctrl+C來剪下
  6. 禁止使用Ctrl+X來複製
  7. 禁止使用Ctrl、ALT和Shift等鍵,禁止組合鍵來進行複製操作。
  8. 兼容Opera,IE,Chrome,Firefox等各種瀏覽器。 

 

使用方法:
1﹑首先在網頁中的</head>標簽之前添加以下CSS源始碼(不能放置在.css文件中):

<style type="text/css">
body {
 -moz-user-select : none;
 -webkit-user-select: none;
}
</style>

2﹑然後在網頁中插入或調用以下JS代碼:

<script type="text/javascript">
function iEsc(){ return false; }
function iRec(){ return true; }
 
function DisableKeys() {
 if(event.ctrlKey || event.shiftKey || event.altKey) {
  window.event.returnValue=false;
  iEsc();
 }
}
 
document.ondragstart=iEsc;
document.onkeydown=DisableKeys;
document.oncontextmenu=iEsc;
 
if (typeof document.onselectstart !="undefined"){
 document.onselectstart=iEsc;
}else{
 document.onmousedown=iEsc;
 document.onmouseup=iRec;
}
 
function DisableRightClick(qsyzDOTnet){
if (window.Event){
 if (qsyzDOTnet.which == 2 || qsyzDOTnet.which == 3){
  iEsc();
 }else{
  if (event.button == 2 || event.button == 3){
   event.cancelBubble = true
   event.returnValue = false;
   iEsc();
  }
 }
}
</script>
arrow
arrow
    全站熱搜

    taurus770423 發表在 痞客邦 留言(0) 人氣()