宜昌本地软件开发与弱电工程服务商
项目咨询 · 快速响应

[js]js代码复制网页内容时自动加版权信息

2016-10-13 00:16:48 点击量:77 标签: 收藏本文

[js]js代码复制网页内容时自动加版权信息

  1. <script language="javascript"> 
  2.  
  3. document.body.oncopy = function () {  
  4.  
  5.   setTimeout( function () {  
  6.  
  7.     var text = clipboardData.getData("text"); 
  8.  
  9.     if (text) {  
  10.  
  11.       texttext = text + " \r\n酷播资料引用:"+location.href; clipboardData.setData("text", text); 
  12.  
  13.     }  
  14.  
  15.         }, 100 )  
  16.  
  17.  
  18.     </script>