PHP里如何让自己网页的内容防止被复制的代码?

来源:百度知道 编辑:UC知道 时间:2024/05/15 16:11:27
请高人帮忙。
小第初学,跪谢了

1、在不想被复制内容的php页面中添加引用<script src="../nocopy.js" type="text/javascript"></script>

  2、同时在网站文件夹中放入nocopy.js文件,当前../nocopy.js表示nocopy.js文件在根文件夹中

  3、nocopy.js中的文件内容是:

  var omitformtags=["input", "textarea", "select"]
  omitformtags=omitformtags.join("|")

  function disableselect(e){
  if (omitformtags.indexOf(e.target.tagName.toLowerCase())==-1)
  return false
  }

  function reEnable(){
  return true
  }

  if (typeof document.onselectstart!="undefined")
  document.onselectstart=new Function ("return false")
  else{
  document.onmousedown=disableselect
  document.onmouseup=reEnable
  }

用JS写呢,给你写个例子:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<script language="javascript">