JS Click the copy copy plugin--zero Clipboard

Source: Internet
Author: User

Blogging is a week in the work of the problems encountered, one advantage is that you can make a summary, another advantage is that the next time you encounter the same problem even if you do not remember, you can look through your blog to solve. It can also help others to meet the same problems as you. Or someone else has a better solution than you can discuss together and analyze a better solution. So it's a good habit. Since it's a good habit, you have to stick to it.


But it seems not so easy to write a blog, because you have to have a problem, otherwise you write, hands on the keyboard do not know what to knock. Or you take the initiative to study, the study of your summary. Then you have to write.

The Bayesian approach I shared with my colleagues this week was a big sensation for me. It seems that I have broadened my horizons. It involves a lot of statistics, psychology and many other disciplines, and then I summed up myself, learning things seem to have learned is fur. Didn't go into it. Bayesian algorithm is not completely clear, in the Internet to read some information, can only say a little understand. Of course, such a good thing is not understood at once, then I will spend a little more time. But before I know it all, let me write a blog about Bayesian methods that I think is difficult for me. I try to understand, also take PPT to my girlfriend probably said again, convenient oneself enhance memory. She seems to understand it. She always thinks she has a higher IQ than me. Well, it's far away.


Let's write a question about a job this week.

The problem is as follows:

There are many columns in the table, and I have to copy the URLs for each column. Click Copy to copy the URL of the forefront;

There are many ways to find the Internet. found that although the functionality can be implemented, but browser compatibility is not.

Then think to find JS plug-in, found a browser is compatible with a good JS copy plugin Zero Clipboard .

The implementation principle of Zero Clipboard The Zero Clipboard uses Flash for replication, prior to 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 Zero Clipboard First download the Zero Clipboardand unzip it. It requires two files: Zeroclipboard.js and zeroclipboard.swf, and put these two files into your project.

After downloading, there is a small example. As follows:

<! DOCTYPE Html>

Effects such as:


Then you can paste the Ctrl + V where you need them.

Then use the function in the actual project,

Effects such as:


The code is as follows:

In the TD label of the content to be copied in the TR add:

Note: $i is a cyclic data. Cycle once, $i + +;

<TD id= ' fe_text<?php echo $i;?> ' >

The styles are introduced as follows:

<script type= "Text/javascript" src= "/misc/js/zeroclipboard.js" ></script><script type= "text/ JavaScript "><?php for ($r =0; $r < $i; $r + +): >var clip = new Zeroclipboard (document.getElementById (" D_clip_ button<?php Echo ($r + 1);?> "), {  Moviepath:"/misc/js/zeroclipboard.swf "}), Clip.on (' Complete ', function ( Client, args) {   alert ("Copy succeeded, copy content:" + Args.text);}); <?php endfor;?></script>


Finally, OK, test a few browser functions are OK.




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.