使用jquery防止鼠标右击和键盘F12的代码
使用jquery防止鼠标右键和键盘F12的代码
- 静态页面
- forbidF12.js文件
- 效果图
静态页面
<!DOCTYPE html>
<html lang="en"><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta charset="UTF-8">
<title>防F12js</title>
<script type="text/javascript" src="forbidF12.js"></script>
</head>
<body>
<div>
你F12试试
</div>
</body></html>
forbidF12.js文件
document.onkeydown=function(){
var e = window.event||arguments[0];
if(e.keyCode==123){
alert('禁止F12和鼠标右键了!www.qipa250.com');
return false;
}else if((e.ctrlKey)&&(e.shiftKey)&&(e.keyCode==73)){
alert('禁止F12和鼠标右键了!www.qipa250.com');
return false;
}else if((e.ctrlKey)&&(e.keyCode==85)){
alert('禁止F12和鼠标右键了!www.qipa250.com');
return false;
}else if((e.ctrlKey)&&(e.keyCode==83)){
alert('禁止F12和鼠标右键了!www.qipa250.com');
return false;
}
}
document.oncontextmenu=function(){
alert('禁止F12和鼠标右键了!www.qipa250.com');
return false;
}
效果图
键盘按F12和鼠标右击
还没有评论,来说两句吧...