1、在不想被复制内容的php页面中添加引用<script src="../nocopy.js" type="text/javascript"></script>
document.onselectstart=new Function ("return false")
else{
document.οnmοusedοwn=disableselect
document.οnmοuseup=reEnable
}
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
}
document.onselectstart=new Function ("return false")
else{
document.οnmοusedοwn=disableselect
document.οnmοuseup=reEnable
}