一共兩塊代碼 一個禁止F12和鼠標右鍵代碼 代碼可以禁止別人F12和鼠標右鍵代碼 可以防止別人偷去你的代碼和你的源碼
//禁止右鍵
function click(e) {
if (document.all) {
if (event.button == 2 || event.button == 3) {
alert("禁止惡意拿代碼的");
oncontextmenu = "return false";
}
}
if (document.layers) {
if (e.which == 3) {
oncontextmenu = "return false";
}
}
}
if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);
}
document.onmousedown = click;
document.oncontextmenu = new Function("return false;");
document.onkeydown = document.onkeyup = document.onkeypress = function() {
if (window.event.keyCode == 12) {
window.event.returnValue = false;
return false;
}
};//禁止F12
function fuckyou() {
window.close();
//關閉當前窗口(防抽)
window.location = "about:blank";
}
function click(e) {
if (document.all) {
if (event.button == 2 || event.button == 3) {
alert("禁止惡意拿代碼的");
oncontextmenu = "return false";
}
}
if (document.layers) {
if (e.which == 3) {
oncontextmenu = "return false";
}
}
}
if (document.layers) {
fuckyou();
document.captureEvents(Event.MOUSEDOWN);
}
document.onmousedown = click;
document.oncontextmenu = new Function("return false;");
document.onkeydown = document.onkeyup = document.onkeypress = function() {
if (window.event.keyCode == 123) {
fuckyou();
window.event.returnValue = false;
return false;
}
};





