1. 程式人生 > >禁止右鍵功能

禁止右鍵功能

網頁 char ctype meta html height 右鍵菜單 eve select

<!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>

  

禁止右鍵功能