在浏览器屏蔽右键、文本选择、文本拖动、复制等操作

事件 说明
 oncontextmenu   在用户点击鼠标右键打开上下文菜单时触发 
 onselectstart  在用户开始选取元素时触发
 ondragstart   在用户开始拖动元素时触发
 oncopy  在用户拷贝元素内容时触发

当事件被触发,使用 return false; 语句能够禁用默认的事件行为。

<html>
<head>
    <title>hello</title>
    <script type="text/javascript">
        // document.oncontextmenu = function(){return false;};    // 屏蔽右键
        // document.onselectstart = function(){return false;};    // 屏蔽选择文本
        // document.ondragstart = function(){return false;};      // 屏蔽拖动文本
        // document.oncopy = function(){return false;};           // 屏蔽复制
    </script>
</head>
<body leftmargin=0 topmargin=0>
    <p>hello world</p>
</body>
</html>
原文地址:https://www.cnblogs.com/huey/p/4445322.html