禁止右键功能

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
    </head>
    <style media="screen">
        body,html{
            height: 100%;
        }
    </style>
    <body
         oncontextmenu="return false"
        ondragstart="return false" onselectstart ="return false" onbeforecopy="return false">
DFASFDASDFASDFASDFASDF 阿法狗撒旦法噶撒的发生的
    </body>
    <script type="text/javascript">
    // oncontextmenu事件禁用右键菜单
    // document.oncontextmenu = function(){
    //     event.returnValue = false;
    // }
    // document.oncontextmenu = function(){
    //     return false;
    // }
    // onselectstart事件禁用网页上选取的内容;
    // document.onselectstart = function(){
    //     event.returnValue = false;
    // }
    // oncopy事件禁用复制
    // document.oncopy = function(){
    //     event.returnValue = false;
    // }
    // 以上三种事件,如果只想单纯的禁用鼠标右键,和复制粘贴,还可以将它们直接写到HTML中的body上面;
//     <body oncontextmenu = "return false" ></body>
//
// <body onselectstart = "return false" ></body>
//
// <body oncopy = "return false" ></body>
// document.ondragstart=function(){
//     return false
// }
    </script>
</html>

  

原文地址:https://www.cnblogs.com/yiyi17/p/7598492.html