功能:
- 禁止使用右鍵來複製內容
- 禁止使用瀏覽器選單的複製和全選來複製內容
- 禁止使用滑鼠選擇內容
- 禁止使用Ctrl+A來全選
- 禁止使用Ctrl+C來剪下
- 禁止使用Ctrl+X來複製
- 禁止使用Ctrl、ALT和Shift等鍵,禁止組合鍵來進行複製操作。
- 兼容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>
全站熱搜