紫影基地

 找回密码
 立即注册
查看: 418|回复: 0

360doc个人图书馆里的禁止复制是怎么实现的?

[复制链接]
阅读字号:

2006

主题

2121

帖子

21万

积分

超级版主

Rank: 8Rank: 8

积分
211131
发表于 2022-1-5 19:47:58 | 显示全部楼层 |阅读模式
  1. <BODY oncontextmenu="return false" onselectstart="return false"
  2. ondragstart="return false" onbeforecopy="return false" oncopy=document.selection.empty() onselect=document.selection.empty()>

  3. -----------------------------------------------

  4. 防止复制的js

  5. -----------------------------------------------

  6. <SCRIPT language=JavaScript1.2>
  7. function disableselect(e){
  8. return false}
  9. function reEnable(){return true
  10. }
  11. file://if IE4+
  12. document.onselectstart=new Function ("return false")
  13. file://if NS6
  14. if (window.sidebar){
  15. document.onmousedown=disableselect
  16. document.onclick=reEnable
  17. }
  18. </SCRIPT>
  19. <SCRIPT language=JavaScript type=text/JavaScript>
  20. <!--
  21. function MM_reloadPage(init) {    //reloads the window if Nav4 resized
  22.     if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
  23.       document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  24.     else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
  25. }
  26. MM_reloadPage(true);
  27. //-->
  28. </SCRIPT>

  29. -------------------------------------------------------

  30. 防止下载的js

  31. -------------------------------------------------------
  32. <noscript><iframe src=""></iframe></noscript>

  33. --------------------------------------------------------

  34. 下面是防止右键的js:

  35. --------------------------------------------------------

  36. <script language="JavaScript">

  37. <!--
  38. if (window.Event)
  39. document.captureEvents(Event.MOUSEUP);
  40. function nocontextmenu() {
  41. event.cancelBubble = true
  42. event.returnValue = false;
  43. return false;
  44. }
  45. function norightclick(e) {
  46. if (window.Event){
  47.    if (e.which == 2 || e.which == 3)
  48.    return false;
  49. }else{
  50.    if (event.button == 2 || event.button == 3){
  51.        event.cancelBubble = true
  52.     event.returnValue = false;
  53.        return false;
  54.     }
  55. }
  56. }

  57. document.oncontextmenu = nocontextmenu; // for IE5+
  58. document.onmousedown = norightclick; // for all others
  59. //-->
  60. </script>
复制代码


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|紫影基地

GMT+8, 2025-1-27 11:23 , Processed in 0.226404 second(s), 18 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表