在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()'>

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

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

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

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

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

oncopy='document.selection.empty()'禁止复制

onbeforecopy='return false' 禁止复制

onmouseup='document.selection.empty()'

相关文章:

  • 2021-07-12
  • 2022-12-23
  • 2021-12-06
  • 2021-06-05
  • 2021-06-12
  • 2022-01-09
  • 2021-07-14
猜你喜欢
  • 2022-12-23
  • 2021-11-23
  • 2022-01-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案