在body中用最简单的方法实现禁止鼠标右键,选中,拖动等

<body 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.

在代码中看到body标签里面有很多属性,一部分不清楚,因此整理下:

οndragstart="return false" 禁止鼠标在网页上拖动

onselectstart="return false" 禁止鼠标选中文字

οnselect='document.selection.empty()' 禁止鼠标选中文字

οncοntextmenu="return false" 在页面的Body范围内,当触发客户端的ContextMenu事件时,返回false值,使右键不能弹出

οncοpy='document.selection.empty()'禁止复制

onbeforecopy='return false' 禁止复制

οnmοuseup='document.selection.empty()'

作者:Alone°李道长ご