0
点赞
收藏
分享

微信扫一扫

网页防止复制、防止下载、防止右键的js


网页防止复制、防止下载、防止右键的js

<body>标签的设置:
 <BODY οncοntextmenu="return false" onselectstart="return false" 
 οndragstart="return false" onbeforecopy="return false" οncοpy=document.selection.empty() οnselect=document.selection.empty()> 
 
 防止复制的js:
 <SCRIPT language=JavaScript1.2>
 function disableselect(e){
 return false}
 function reEnable(){return true
 }
 file://if IE4+
 document.onselectstart=new Function ("return false")
 file://if NS6
 if (window.sidebar){
 document.οnmοusedοwn=disableselect
 document.οnclick=reEnable
 }
 </SCRIPT>
 <SCRIPT language=JavaScript type=text/JavaScript>
 <!--
 function MM_reloadPage(init) {    //reloads the window if Nav4 resized
     if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
       document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; οnresize=MM_reloadPage; }}
     else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
 }
 MM_reloadPage(true);
 //-->
 </SCRIPT>



防止下载的js:

<noscript><iframe src=""></iframe></noscript>


下面是防止右键的js:

<script language="JavaScript">

 <!--
 if (window.Event) 
 document.captureEvents(Event.MOUSEUP); 
 function nocontextmenu() {
 event.cancelBubble = true
 event.returnValue = false;
 return false;
 }
 function norightclick(e) {
 if (window.Event){
    if (e.which == 2 || e.which == 3)
    return false;
 }else{
    if (event.button == 2 || event.button == 3){
        event.cancelBubble = true
     event.returnValue = false;
        return false;
     }
 }
 }

 document.oncontextmenu = nocontextmenu; // for IE5+
 document.onmousedown = norightclick; // for all others
 //-->
 </script>


举报

相关推荐

0 条评论