網頁常用的防復制代碼


最牛的防復制代碼1:(將此代碼粘貼到body中可以有效防選中防復制和防鼠標右鍵)

<script type="text/javascript">document.body.oncontextmenu=document.body.ondragstart= document.body.onselectstart=document.body.onbeforecopy=function(){return false;};
document.body.onselect=document.body.oncopy=document.body.onmouseup=function(){document.selection.empty();};</script>

最牛的防復制代碼2:(將此代碼粘貼到body中可以有效防選中防復制和防鼠標右鍵)

<script language="JavaScript">
document.oncontextmenu=new Function("event.returnValue=false;");
document.onselectstart=new Function("event.returnValue=false;");
</script>

禁止查看網頁源文件代碼,插入網頁即可。

<body leftmargin="2" topmargin="0" marginwidth="0" marginheight="0" oncontextmenu="return false" ondragstart="return false" onselectstart ="return false" onselect="document.selection.empty()" oncopy="document.selection.empty()" onbeforecopy="return false" onmouseup="document.selection.empty()">
<noscript><iframe src="/blog/*>";</iframe></noscript>

1.將徹底屏蔽鼠標右鍵 

oncontextmenu="window.event.returnvalue=false"
<table border oncontextmenu=return(false)><td>no</table> //可用於Table

2.取消選取、防止復制

<body onselectstart="return false">

3.不准粘貼

onpaste="return false"

4.防止復制

oncopy="return false;" oncut="return false;"

5.防止被人frame

<SCRIPT LANGUAGE=javascript><!-- if (top.location != self.location)top.location=self.location; // --></SCRIPT>

6.網頁將不能另存為

<noscript><iframe src="/blog/*.html>";</iframe></noscript>

7.改變連接是狀態欄的顯示內容

<a href="http://www.toyean.com" onMo ... ;window.status='輸入連接狀態欄顯示內容&rsquo;;return true">

8.禁止網頁中目標對象被下載(如圖片) 

下面的代碼將幫助你禁止網頁中目標對象被下載:

<a href="javascript:void(0)" onMouseDown="alert('對不起!圖片不能下載!')"><img src="圖片地址" alt="" /></a>

9.頁面禁止刷新完全,最好在pop出來的窗口里用,沒工具欄的

<body onkeydown="KeyDown()" onbeforeunload="location=location" 
oncontextmenu="event.returnValue=false">
<script language="Javascript"><!-- 
function KeyDown(){ 
if ((window.event.altKey)&& 
     ((window.event.keyCode==37)||   
      (window.event.keyCode==39))){alert("請訪問我的主頁"); 
    event.returnValue=false; 
    } 
if ((event.keyCode==8)||(event.keyCode==116)){//屏蔽 F5 刷新鍵 
    event.keyCode=0; 
    event.returnValue=false; 
    } 
if ((event.ctrlKey)&&(event.keyCode==78)){   //屏蔽 Ctrl+n 
    event.returnValue=false; 
    } 
if ((event.shiftKey)&&(event.keyCode==121)){ //屏蔽 shift+F10 
    event.returnValue=false; 
    } 
} 
</script> 
</body>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM