复制文章内容自动添加文章链接

作者: 坎肩儿 分类: HTML+CSS,JS代码 发布时间: 2011-04-15 01:15

代码如下,不多做解释:

<script>
document.body.oncopy = function ()
{ setTimeout( function () { var text = clipboardData.getData(“text”);
if (text) { text = text + “\n本文转载自:用键盘记录人生(http://www.pksafe.cn) \n文章地址:”+location.href; clipboardData.setData(“text”, text); } }, 100 ) }
</script>