禁止复制(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>
禁止复制
原文地址:https://www.cnblogs.com/ziranquliu/p/4599379.html