首页 > 分享 > javaScript禁止鼠标右键及F12禁止查看源代码及禁止其他操作

javaScript禁止鼠标右键及F12禁止查看源代码及禁止其他操作

最新推荐文章于 2024-06-25 10:40:22 发布

有趣的前端 于 2020-09-18 21:49:15 发布

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。

1. 屏蔽F12 审查元素

<script> document.onkeydown = function () { if (window.event && window.event.keyCode == 123) { alert("F12被禁用"); event.keyCode = 0; event.returnValue = false; } if (window.event && window.event.keyCode == 13) { window.event.keyCode = 505; } if (window.event && window.event.keyCode == 8) { alert(str + "n请使用Del键进行字符的删除操作!"); window.event.returnValue = false; } } </script>

1234567891011121314151617'

2. 屏蔽右键菜单

<script> document.oncontextmenu = function (event) { if (window.event) { event = window.event; } try { var the = event.srcElement; if (!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")) { return false; } return true; } catch (e) { return false; } } </script>

1234567891011121314151617'

3. 屏蔽粘贴

<script> document.onpaste = function (event) { if (window.event) { event = window.event; } try { var the = event.srcElement; if (!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")) { return false; } return true; } catch (e) { return false; } } </script>

1234567891011121314151617'

4. 屏蔽复制

<script> document.oncopy = function (event) { if (window.event) { event = window.event; } try { var the = event.srcElement; if (!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")) { return false; } return true; } catch (e) { return false; } } </script>

1234567891011121314151617'

5. 屏蔽剪切

<script> document.oncut = function (event) { if (window.event) { event = window.event; } try { var the = event.srcElement; if (!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")) { return false; } return true; } catch (e) { return false; } } </script>

1234567891011121314151617'

6. 屏蔽选中

<script> document.onselectstart = function (event) { if (window.event) { event = window.event; } try { var the = event.srcElement; if (!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")) { return false; } return true; } catch (e) { return false; } } </script>

1234567891011121314151617'

相关知识

依据《中华人民共和国进境植物检疫禁止进境物名录》,禁止进境的植物病原体包括()
扩大从业禁止范围 学龄前儿童保护升级
禁止寄递物品指导目录
禁止携带、邮寄进境的动植物及其产品名录
广西柳州殡仪馆禁止花圈入内 高价出租牟利
中华人民共和国禁止携带、邮寄的动植物及其产品名录
打通信息壁垒 合围“禁而不止”浙江仙居:开展禁止令和从业禁止执行专项监督
除了环境保护,禁止燃放烟花还有什么理由?
向日葵种子也被禁止入境?
安新县人民政府关于禁止猎捕野生动物的通告

网址: javaScript禁止鼠标右键及F12禁止查看源代码及禁止其他操作 https://m.huajiangbk.com/newsview1199714.html

所属分类:花卉
上一篇: 【环境适应】提升PID算法在复杂
下一篇: Spring任务执行和调度(Ta