JS Click the copy copy plugin--zero Clipboard

Source: Internet
Author: User

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


But want to write a blog is not so easy, because you have to have a problem, otherwise you write, hand on the keyboard do not know what to knock. Or you learn automatically, to summarize your study. 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 so many disciplines, and then I summed up myself, learning things seem to have learned is fur. Didn't go into it. Bayesian algorithm has not been completely clear, on the Internet to read some information, only can be said to understand a little. Of course, such a good thing is not understood at once, then I will spend a little more time. But before I get it all figured out, let me write a blog about Bayesian methods. I think it's a certain difficulty 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 felt that she had a higher IQ than me. Well, it's far away.


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

Problems such as the following:

There are a lot of 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 a lot of ways to find it online. Discover that although the functionality can be implemented, 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 to replicate, before the Clipboard copy solution, which exploits a hidden flash. But the latest Flash Player 10 just agrees to start the Clipboard with the ability to operate on flash. So the Zero Clipboard improved on this, using a transparent flash to float on the button, so that the fact that the click is not a button but flash, you can use the copy function of Flash.

Span style= "FONT-SIZE:18PX; Color: #009900 ">   First download the Zero Clipboardand unzip it. You need two files: Zeroclipboard.js and zeroclipboard.swf, and put these two files into your project.

After downloading, there is a sample. For example, the following:

<! DOCTYPE Html>

Effects such as:


Then CTRL + V will be able to paste it where you need it.

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 for example the following:

<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.