易优模板_网站html模板-网站运营易优模板_网站html模板-网站运营易优模板_网站html模板-网站运营

即学即用:网页常用的防复制代码

最牛的防复制代码

1.将此代码粘贴到body中可以有效防选中防复制和防鼠标右键


  1.  
    <script type="text/javascript">
  2.  
    document.body.oncontextmenu =
  3.  
    document.body.ondragstart =
  4.  
    document.body.onselectstart =
  5.  
    document.body.onbeforecopy =
  6.  
    function () { return false; };
  7.  
     
  8.  
    document.body.onselect =
  9.  
    document.body.oncopy =
  10.  
    document.body.onmouseup =
  11.  
    function () { document.selection.empty(); };
  12.  
    </script>

2.将此代码粘贴到body中可以有效防选中防复制和防鼠标右键


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

3.禁止查看网页源文件代码,插入网页即可。


  1.  
    <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()">
  2.  
    <noscript><iframe src="/blog/*>";</iframe></noscript>

4.将彻底屏蔽鼠标右键


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

5.取消选取、防止复制

<body onselectstart="return false">

6.不准粘贴

onpaste="return false"

7.防止复制

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

8.防止被人frame

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

9.网页将不能另存为

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

10.改变连接是状态栏的显示内容

<a href="http://www.toyean.com" onMo ... ;window.status="输入连接状态栏显示内容&rsquo;;return true">

11.禁止网页中目标对象被下载(如图片)

下面的代码将帮助你禁止网页中目标对象被下载:

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

12.页面禁止刷新完全,最好在pop出来的窗口里用,没工具栏的


  1.  
    <body onkeydown="KeyDown()" onbeforeunload="location=location"
  2.  
    oncontextmenu="event.returnValue=false">
  3.  
    <script language="Javascript"><!--
  4.  
    function KeyDown(){
  5.  
    if ((window.event.altKey)&&
  6.  
    ((window.event.keyCode==37)||
  7.  
    (window.event.keyCode==39))){alert("请访问我的主页");
  8.  
    event.returnValue=false;
  9.  
    }
  10.  
    if ((event.keyCode==8)||(event.keyCode==116)){//屏蔽 F5 刷新键
  11.  
    event.keyCode=0;
  12.  
    event.returnValue=false;
  13.  
    }
  14.  
    if ((event.ctrlKey)&&(event.keyCode==78)){ //屏蔽 Ctrl+n
  15.  
    event.returnValue=false;
  16.  
    }
  17.  
    if ((event.shiftKey)&&(event.keyCode==121)){ //屏蔽 shift+F10
  18.  
    event.returnValue=false;
  19.  
    }
  20.  
    }
  21.  
    </script>
  22.  
    </body>

 

未经允许不得转载:易优模板_网站html模板-网站运营 » 即学即用:网页常用的防复制代码