禁止右键代码

发布时间 2010-08-05

在做网页的时候,有的客户可能会要求不愿别人复制他网站的文字及图片等资料,这时我们仅需要在客户网站的相关页面的尾部加入以下代码即可:

(如果将代码加入顶不去或底部区,全站的页面都不可以右键复制)

<body onselectstart="return false">
<script>
//加入页面保护
    function rf()
      {return false; }
    document.oncontextmenu = rf
    function keydown()
      {if(event.ctrlKey ==true || event.keyCode ==93 || event.shiftKey ==true){return false;} }
      document.onkeydown =keydown
    function drag()
      {return false;}
    document.ondragstart=drag
function stopmouse(e) {
  if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2)) 
   return false;
      else if 
      (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3)) { 
     return false; 
   }
  return true;
      }
      document.onmousedown=stopmouse; 
      if (document.layers)
      window.captureEvents(Event.MOUSEDOWN);
       window.onmousedown=stopmouse; 
</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; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
<script language="Javascript" type="text/Javascript">
<!--
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
function hidaccounce(){
 eval("document.all[\"accounce\"].style.display = \"none\"");
 //SetCookie ("accounce","close");
}
function closeaccounce(){
 //if (GetCookie("accounce")=="close"){
  //eval("document.all[\"accounce\"].style.display = \"none\"");
 //}
}
//-->
</script>

[ 点击数:] [打印本网页] [关闭本窗口]
 

相关内容
查无记录

 

 

 

 

     

备案/许可证号:豫ICP备12020940号 
 
豫公网安备 41130202000282号
版权所有:天润科技
E-Mail:
sjwb666@163.com
在线咨询: 
网站管理

地址:河南省南阳市独山大道华鑫苑23号楼 
电话:0377-63205555 
手机:18736673333
Q Q:857359069

免责声明:本站部分图文来源于互联网,如果您发现网站上有侵犯您的知识产权的作品,请与我们取得联系,我们会及时删除。

网站管理