为了防止别人复制企业网站的内容,可以使用以下的代码。
那么我们就让别人复制后.粘贴到任何地方.都带有自己的连接吧.
//复制内容自动添加版权信息
var thehits=document.getElementById("thehit");
if (thehits!=null){
thehits.innerHTML="22936";
}
document.body.oncopy = function ()
{
setTimeout(
function ()
{
var text = clipboardData.getData("text");
if (text)
{
text = text + "\r\n本文转自【网站名称】:"+location.href;
clipboardData.setData("text", text);
}
},
100
)
}
window.onload = function()
{
this.focus();
}
把以上代码.保存为XXX.js文件 (XXX为任意文件名)
然后在需要维护版权的文章页面插入代码:
|