JS禁止网页被复制以及禁止鼠标右击代码

来源:互联网 发布:ubuntu重启搜狗输入法 编辑:程序博客网 时间:2024/05/17 00:09
<script type="text/javascript">    //禁止鼠标右键    document.oncontextmenu = function(){        return false;    }    //禁止元素被选中    if (typeof(document.onselectstart) != 'undefined') {               // IE chrome下禁止元素被选中               document.onselectstart = function(){            return false;        }    } else {            // firefox下禁止元素被选中的变通办法                   document.write('<style type="text/css">body { -moz-user-select: none; }</style>');         }</script> 
0 0