The realization principle of Zeroclipboard
Zeroclipboard uses Flash for replication, previously with the Clipboard copy solution, which exploits a hidden flash. However, the latest Flash Player 10 only allows operation on Flash to start the Clipboard. So the Zero Clipboard to improve this, with a transparent flash, let it float on the button above, so in fact, the click is not the button but flash, you can use the copy function of Flash.
How to use Zeroclipboard
First download the Zeroclipboard and unzip it. It requires two files: Zeroclipboard.js and zeroclipboard.swf, and put these two files into your project.
Second, the effect can only be seen on the server, so you can create a virtual project in your PC's IIS.
The effect is as follows:
Words not much to say, directly on the code:
Reference:
<script src= "Jquery.min.js" ></script><script src= "jquery. Zeroclipboard.js "></script>
HTML Code:
< input type = "text" ID = "TXT" class = "TXT" /> < input type = "button" = "click Copy" ID = "Copy" class = "Copy" Data-clipboard-target = "TXT" />
JS Code:
<Script>$(function(){ //Copy URL varClip= NewZeroclipboard (document.getElementById ("Copy"), {moviepath:"zeroclipboard.swf" }); //Replication succeededClip.on (' Complete', function(client, args) {//Args.textAlert ("has been copied to the Clipboard"); }); })</Script>
Click Download Zeroclipboardjs+flash to copy content to clipboard instance Demo
Zeroclipboardjs+flash implementation to copy content to the Clipboard instance