给网站添加版权声明代码
建站教程 阅读1、方法一:JS调用代码:
< script type = ”text / javascript”> function addLink() { var selection = window.getSelection(); pagelink = “.原文出自[ 牛教程 ]转载请保留原文链接: ”+document.location.href; copytext = selection + pagelink; newdiv = document.createElement(‘div’); newdiv.style.position = ‘absolute’; newdiv.style.left = ‘-99999px’; document.body.appendChild(newdiv); newdiv.innerHTML = copytext; selection.selectAllChildren(newdiv); window.setTimeout(function() { document.body.removeChild(newdiv); }, 100); } document.oncopy = addLink; < /script>
2、方法二:版权代码2:
function addLink() { var body_element = document.body; var selection; selection = window.getSelection(); if (window.clipboardData) { // Internet Explorer var pagelink =”rnrn 原文出自[ 牛教程 ] 转载请保留原文链接: “+document.location.href+””; var copytext = selection + pagelink; window.clipboardData.setData (“Text”, copytext); return false; } else { var pagelink = ” 原文出自[ 牛教程 ] 转载请保留原文链接: “+document.location.href+””; var copytext = selection + pagelink; var newdiv = document.createElement(‘div’); newdiv.style.position=’absolute’; newdiv.style.left=’-99999px’; body_element.appendChild(newdiv); newdiv.innerHTML = copytext; selection.selectAllChildren(newdiv); window.setTimeout(function() { body_element.removeChild(newdiv); },0); } } document.oncopy = addLink;
本文链接:https://niujc.com/not/1218889.html
栏目:建站教程
来源:
标签:
时间:2023-05-23
晚上好!当前时间为
目前距离2024年春节还有
TOP