Home  >  Article  >  Web Front-end  >  Provide js code [original]_javascript skills that appear when copying the content of this site. The article is reproduced from Script House etc.

Provide js code [original]_javascript skills that appear when copying the content of this site. The article is reproduced from Script House etc.

WBOY
WBOYOriginal
2016-05-16 19:16:101224browse

Original on this site, please indicate the source for reprintingScript House
I found that recently there are always people asking me for such code. When copying articles from this site, you can actually just copy this site For something, just add one sentence, the article is reprinted from Script House and the content address is added. This has many benefits for promoting this site. You can search for it, such as a better way to increase reverse connections

Copy code The code is as follows:

document.body.oncopy = function () //When copying occurs Trigger the function when the event occurs, whether it is ctrl c or right-click - copy
{
setTimeout(
function ()
var text = clipboardData.getData("text"); if (text)
                                                                                     }                                                                                                                       },
100
)
}
window.onload = function()
{
this.focus(); //After the content is loaded, get focus
}


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn