本段js需要引入jquery,请自行引入吧!
我测试的时候用的jquery2.1.4!
<script type="text/javascript"> $(document).ready(function(){ //jQuery 屏蔽右键 $(document).bind("contextmenu",function(e){return false;});}); $(document).ready(function() { //jQuery 屏蔽F5 $(document).bind("keydown",function(e){e=window.event||e; if(e.keyCode==116){e.keyCode = 0;return false;} }); }); $(document).ready(function() { //jQuery 屏蔽F7 $(document).bind("keydown",function(e){e=window.event||e; if(e.keyCode==118){e.keyCode = 0;return false;} }); }); $(document).ready(function() { //jQuery 屏蔽F11 $(document).bind("keydown",function(e){e=window.event||e; if(e.keyCode==122){e.keyCode = 0;return false;} }); }); $(document).ready(function() { //jQuery 屏蔽F12 $(document).bind("keydown",function(e){e=window.event||e; if(e.keyCode==123){e.keyCode = 0;return false;} }); }); </script>
文章作者:博客之家
文章標題:一段js代码屏蔽右键 F12 审核元素查看源代码
文章鏈接:https://www.blogs.hk/2956.html
本站所有文章除特別聲明外,均採用 CC BY-NC-SA 4.0 許可協議,轉載請註明來自博客之家 !
文章標題:一段js代码屏蔽右键 F12 审核元素查看源代码
文章鏈接:https://www.blogs.hk/2956.html
本站所有文章除特別聲明外,均採用 CC BY-NC-SA 4.0 許可協議,轉載請註明來自博客之家 !
发表评论