一共两块代码 一个禁止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;
}
};





