QQ登录

只需要一步,快速开始

APP扫码登录

只需要一步,快速开始

手机号码,快捷登录

泡泡马甲APP 更多内容请下载泡泡马甲手机客户端APP 立即下载 ×
查看: 1852|回复: 0

[HTML/CSS/JS] 禁止F12和鼠标右键代码

[复制链接]

等级头衔

积分成就    金币 : 2802
   泡泡 : 1516
   精华 : 6
   在线时间 : 1242 小时
   最后登录 : 2024-4-18

丰功伟绩

优秀达人突出贡献荣誉管理论坛元老

联系方式
发表于 2018-11-23 00:50:22 | 显示全部楼层 |阅读模式
       禁止F12和鼠标右键代码,代码可以禁止别人F12和鼠标右键代码,可以防止别人偷去你的代码和你的源码。' @$ W" x, w  p& m
  1. <script>//禁止右键
  2. function click(e) {
  3. if (document.all) {
  4. if (event.button==2||event.button==3) { alert("禁止恶意拿代码的");
  5. oncontextmenu='return false';
  6. }
  7. }
  8. if (document.layers) {
  9. if (e.which == 3) {
  10. oncontextmenu='return false';
  11. }
  12. }
  13. }
  14. if (document.layers) {
  15. document.captureEvents(Event.MOUSEDOWN);
  16. }
  17. document.onmousedown=click;
  18. document.oncontextmenu = new Function("return false;")
  19. document.onkeydown =document.onkeyup = document.onkeypress=function(){
  20. if(window.event.keyCode == 12) {
  21. window.event.returnValue=false;
  22. return(false);
  23. }
  24. }
  25. </script>
  26.        
  27.        
  28. <script>//禁止F12
  29. function fuckyou(){
  30. window.close(); //关闭当前窗口(防抽)
  31. window.location="about:blank"; //将当前窗口跳转置空白页
  32. }
  33. function click(e) {
  34. if (document.all) {
  35.   if (event.button==2||event.button==3) {
  36. alert("禁止恶意拿代码的");
  37. oncontextmenu='return false';
  38. }
  39. }
  40. if (document.layers) {
  41. if (e.which == 3) {
  42. oncontextmenu='return false';
  43. }
  44. }
  45. }
  46. if (document.layers) {
  47. fuckyou();
  48. document.captureEvents(Event.MOUSEDOWN);
  49. }
  50. document.onmousedown=click;
  51. document.oncontextmenu = new Function("return false;")
  52. document.onkeydown =document.onkeyup = document.onkeypress=function(){
  53. if(window.event.keyCode == 123) {
  54. fuckyou();
  55. window.event.returnValue=false;
  56. return(false);
  57. }
  58. }
  59. </script>
js代码无图.jpg

9 B+ M* ]) Z! ^5 V" c
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|小黑屋|paopaomj.COM ( 渝ICP备18007172号 )

GMT+8, 2024-4-19 17:34

Powered by paopaomj X3.4 © 2016-2024 sitemap

快速回复 返回顶部 返回列表