当前位置: 首页 > 图文教程 > 网络编程 > Javascript > [原创]提供复制本站内容时出现,该文章转自IT学习网等字样的js代码

Javascript
form中限制文本字节数js代码
use jscript with List Proxy Server Information
use jscript List Installed Software
List Installed Software Features
List Information About the Binary Files Used by an Application
List the Codec Files on a Computer
List the UTC Time on a Computer
List Installed Hot Fixes
excel操作之Add Data to a Spreadsheet Cell
Add Formatted Data to a Spreadsheet
Apply an AutoFormat to an Excel Spreadsheet
JavaScript语法着色引擎(demo及打包文件下载)
类之Prototype.js学习
一款JavaScript压缩工具:X2JSCompactor
iis6+javascript Add an Extension File
jscript之Open an Excel Spreadsheet
jscript之Read an Excel Spreadsheet
jscript之List Excel Color Values
去除图像或链接黑眼圈的两种方法总结
Add a Formatted Table to a Word Document

Javascript 中的 [原创]提供复制本站内容时出现,该文章转自IT学习网等字样的js代码


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-12   浏览: 112 ::
收藏到网摘: n/a

本站原创,转载请写明出处 软晨学习网
发现最近总有人,问我要这样的代码,当复制本站文章时候,其实可以是只要复制本站的东西,就加上一句,该文章转载自软晨学习网 并加上本内容地址,这样对于推广本站,有好多好处的,大家可以搜下,比如增加反向连接的比较好的办法

复制代码 代码如下:

document.body.oncopy = function () //当发生复制事件时触发函数,不管是ctrl+c还是右键-复制
{
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(); //内容加载完成后,获取焦点
}