• 禁止复制(copy),禁用鼠标右键!


     1 <SCRIPT>
     2 
     3 //加入页面保护
     4 
     5 function rf() {return false; }
     6 
     7 document.oncontextmenu = rf
     8 
     9 function keydown() {
    10 
    11   if(event.ctrlKey ==true || event.keyCode ==93 || event.shiftKey ==true){
    12 
    13     return false;
    14 
    15   }
    16 
    17 }
    18 
    19 document.onkeydown =keydown
    20 
    21 function drag() {return false;}
    22 
    23 document.ondragstart=drag
    24 
    25 function stopmouse(e) {
    26 
    27    if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2)) return false;
    28 
    29   else if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3)) {
    30 
    31     alert("版权没有,但别复制 :)");
    32 
    33     return false;
    34 
    35   }
    36 
    37   return true;
    38 
    39 }
    40 
    41 document.onmousedown=stopmouse;
    42 
    43 if (document.layers) window.captureEvents(Event.MOUSEDOWN);
    44 
    45 window.onmousedown=stopmouse;
    46 
    47 </SCRIPT>
    48 
    49  
    50 
    51 <script language="javascript">
    52 
    53 function JM_cc(ob){
    54 
    55   var obj=MM_findObj(ob);
    56 
    57   if (obj) {
    58 
    59     obj.select();
    60 
    61     js=obj.createTextRange();
    62 
    63     js.execCommand("Copy");
    64 
    65   }
    66 
    67 }
    68 
    69 function MM_findObj(n, d) { //v4.0
    70 
    71   var p,i,x;
    72 
    73   if(!d) d=document;
    74 
    75   if((p=n.indexOf("?"))>0&&parent.frames.length) {
    76 
    77     d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);
    78 
    79   }
    80 
    81   if(!(x=d[n])&&d.all) x=d.all[n];
    82 
    83   for (i=0;!x&&i<d.forms.length;i++) x=d.forms[n];
    84 
    85   for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document);
    86 
    87   if(!x && document.getElementById) x=document.getElementById(n);
    88 
    89   return x;
    90 
    91 }
    92 
    93 </script>
    禁止复制
  • 相关阅读:
    走近Qt
    C: 数组形参
    C++: 单例模式和缺陷
    c++: 获取delete[]中的数组大小
    像素格式
    BMP图像格式
    Sublime Text 格式化JSON-pretty json
    Sublime Text3配置SublimeREPL快捷键的方法(Python)
    Sublime Text3安装SublimeREPL插件以及快捷键设置
    Sublime Text3 注册码激活码(持续更新中2018-11-20)
  • 原文地址:https://www.cnblogs.com/ziranquliu/p/4599379.html
Copyright © 2020-2023  润新知