系统吧 专业的电脑操作系统,支持重装各种原版系统xp/win7/win8/win10 这个系统怎么样?试试系统吧系统,体验办公系统畅快愉悦感。 各种电脑系统安装过程一样,神一般的畅快!
-->
当前位置:主页 > 电脑技术 >

【禁止鼠标右键代码】网页中禁止使用右键,禁止复制script代码大全

作者:梁哲宇 分类:电脑技术 发布时间:2023-03-04 13:09:01

在网页中,辛辛苦苦写的文章,被别人复制粘贴给盗用去另很多站长感到非常无奈,通常大家复制都会使用选取右键复制,或CTRL+C等方式,下面介绍几种禁止鼠标右键代码,可减少网页上文章被抄袭的几率,当然对高手来说,破解也很简单,不管怎么样,我们还是一起试试吧。 使用方法:以下代码加入到 oncontextmenu事件禁用右键菜单代码; js代码: document.oncontextmenu = function(){ event.returnValue = false;}// 或者直接返回整个事件document.oncontextmenu = function(){ ret...

在网页中,辛辛苦苦写的文章,被别人复制粘贴给盗用去另很多站长感到非常无奈,通常大家复制都会使用选取右键复制,或CTRL+C等方式,下面介绍几种禁止鼠标右键代码,可减少网页上文章被抄袭的几率,当然对高手来说,破解也很简单,不管怎么样,我们还是一起试试吧。

【禁止鼠标右键代码】网页中禁止使用右键,禁止复制script代码大全

使用方法:以下代码加入到

oncontextmenu事件禁用右键菜单代码;

js代码:

document.oncontextmenu = function(){ event.returnValue = false;}// 或者直接返回整个事件document.oncontextmenu = function(){ return false;}

onselectstart事件禁用网页上选取的内容;

js代码:

document.onselectstart = function(){ event.returnValue = false;}// 或者直接返回整个事件document.onselectstart = function(){ return false;}

oncopy事件禁用复制;

js代码:

document.oncopy = function(){ event.returnValue = false;}// 或者直接返回整个事件document.oncopy = function(){ return false;}

以上三种事件,如果只想单纯的禁用鼠标右键,和复制粘贴,还可以将它们直接写到HTML中的body上面;

禁用鼠标事件

document.onmousedown = function(e){ if ( e.which == 2 ){// 鼠标滚轮的按下,滚动不触发 return false; } if( e.which==3 ){// 鼠标右键 return false; }}

禁用键盘中的ctrl、alt、shift

document.onkeydown = function(){ if( event.ctrlKey ){ return false; } if ( event.altKey ){ return false; } if ( event.shiftKey ){ return false; }}关键就在

  oncontextmenu='return false'

  ondragstart='return false'

  onselectstart ='return false'

  onselect='document.selection.empty()'

  oncopy='document.selection.empty()'

  onbeforecopy='return false'

  onmouseup='document.selection.empty()'

一个更简单的方法就是在中加入如下的代码,这样鼠标的左右键都失效了.topmargin="0" oncontextmenu="return false" ondragstart="return false" onselectstart ="return false" onselect="document.selection.empty()" oncopy="document.selection.empty()" onbeforecopy="return false" onmouseup="document.selection.empty()"1.禁止网页另存为:在后面加入以下代码:2.禁止网页内容复制.粘贴:在中加入以下代码:

在网站的建设中,文章内容通过技术手段禁止复制只能说是一个辅助作用,保护原创才是正解,目前百度推出了原创保护功能,大家可以去试试哦。

xp 更多>>
win7 更多>>
win8 更多>>
win10 更多>>
U盘 更多>>
电脑技术 更多>>
网站地图 | 豫ICP备2021035069号-4 | 友情链接qq:191064436
系统吧

版权所有 © 2012-2023 系统吧 免责声明:本站资源均收集于互联网,其著作权归原作者所有,如果有侵犯您权利的资源,请来信告知,我们将及时删除相应资源。