网页复制信息时自动提示代码
使用Ctrl+c时才会提示html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
无标题文档function addLink(){var body_element=document.getElementsByTagName('body')[0];var selection;selection=window.getSelection();var pagelink="
原文信息: 原文链接:"+document.location.href+"";var copy_text=selection+pagelink;var new_div=document.createElement('div');new_div.style.left='-99999px';new_div.style.position='absolute';body_element.appendChild(new_div);new_div.innerHTML=copy_text;selection.selectAllChildren(new_div);window.setTimeout(function(){body_element.removeChild(new_div);},0);}
document.οncοpy=addLink;
残梦教程网www.cmylw.cn
/*复制提示js代码*/
function warning(){
if(navigator.userAgent.indexOf("MSIE")>0) {
art.dialog.alert('复制成功!若要转载请务必保留残梦教程网www.cmylw.cn原文链接,申明来源,谢谢合作!');
} else {
alert("复制成功!若要转载请务必保留残梦教程网www.cmylw.cn原文链接,申明来源,谢谢合作!");
}
}
document.body.οncοpy=function(){warning();}