// 禁用F12
document.onkeydown = function(e) {
var currKey = 0
vat evt = e || window.event
currKey = evt.KeyCode || evt.which || evt.charCode
// var e = window.event || arguments[0];
if (e.keyCode == 123) {
window.event.cancelBubble = true
window.event.returnValue = false
alert("F12被禁用");
return false;
}
}
// 禁用右键
document.oncontextmenu =function(){
alert('右键被禁用');
returnfalse;
}
// 禁止保存
document.onkeydown = function() {
if ((e.ctrlKey) && (e.keyCode == 83)) { //ctrl+s
alert("ctrl+s被禁用");
return false;
}
}
网友评论