POST TIME:2018-03-19 22:27
網頁禁止右鍵、禁止查看源代碼、禁止復制和另存為的代碼簡單介紹如下:
代碼一
當按下鼠標左鍵進行選擇或點擊右鍵或按CTRL鍵時,會彈出對話框:
=================================
<!--禁止復制-->
<SCRIPT LANGUAGE=javascript>
function click() {
alert('禁止你的左鍵復制!') }
function click1() {
if (event.button==2) {alert('禁止右鍵點擊~!') }}
function CtrlKeyDown(){
if (event.ctrlKey) {alert('不當的拷貝將損害您的系統!') }}
document.onkeydown=CtrlKeyDown;
document.onselectstart=click;
document.onmousedown=click1;
</SCRIPT>
<!--禁止復制-->
代碼二【推薦】:
當按下鼠標時,無任何反應,從而保護好頁面:
==================================
<!--無法復制-->
<body onmousemove=HideMenu() oncontextmenu="return false" ondragstart="return false" onselectstart ="return false" onselect="document.selection.empty()" oncopy="document.selection.empty()" onbeforecopy="return false" onmouseup="document.selection.empty()">
<!--無法復制-->
以下代碼讓網頁無法保存,但可以另存。