把这段代码加在footr.PHP即可
<script type="text/javascript"> document.body.oncopy=function(){warning();} function addCopyright() { var Original = "本文来源:" + location.href; //修改你的网站名称 if ("function" == typeof window.getSelection) { var c = window.getSelection(); if ("Microsoft Internet Explorer" == navigator.appName && navigator.appVersion.match(/MSIE ([\d.]+)/)[1] >= 10 || "Opera" == navigator.appName) { var g = c.getRangeAt(0), h = document.createElement("span"); h.appendChild(g.cloneContents()), g.insertNode(h); var i = h.innerHTML.replace(/(?:\n|\r\n|\r)/gi, "").replace(/<\s*script[^>]*>[\s\S]*?<\/script>/gim, "").replace(/<\s*style[^>]*>[\s\S]*?<\/style>/gim, "").replace(/<!--.*?-->/gim, "").replace(/<!DOCTYPE.*?>/gi, ""); try { document.getElementsByTagName("body")[0].removeChild(h) } catch(f) { h.style.display = "none", h.innerHTML = "" } } else var d = "" + c; var e = document.getElementsByTagName("body")[0], f = document.createElement("div"); f.style.position = "absolute", f.style.left = "-99999px", e.appendChild(f), f.innerHTML = d.replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, "$1<br />$2") + "<br />" + Original, c.selectAllChildren(f), setTimeout(function() { e.removeChild(f) }, 0) } else if ("object" == typeof document.selection.createRange) { event.returnValue = !1; var c = document.selection.createRange().text; window.clipboardData.setData("Text", c + "\n" + Original) } alert("陌路人温馨提示:复制成功!若要转载请务必保留原文链接,申明来源,谢谢合作!"); }; document.body.oncopy = addCopyright; </script>
发表评论