1024programmer Java ZeroClipboard plug-in implements multi-browser copy function (supports firefox, chrome, ie6)_javascript skills

ZeroClipboard plug-in implements multi-browser copy function (supports firefox, chrome, ie6)_javascript skills

However, it is worth noting that the official introduction has clearly stated that this plug-in does not support ie6. The following will provide the implementation of the multi-instantiation Zero Clipboard copy function and the writing method that is compatible with ie6!

Download ZeroClipboard first http://www.jb51.net/jiaoben/24961.html


Copy content

Copy content

For the above implementation method, except that ie6 uses window.clipboardData.setData to implement the copy function, other browsers use the Zero Clipboard plug-in to implement the copy function!

Some points you should pay attention to when using this plug-in:

1. The above ZeroClipboard.js and ZeroClipboard.swf need to be placed in the same path. If it is not in the same path, you can use ZeroClipboard.setMoviePath(“Flash path”); to set the ZeroClipboard.swf address.

2. Analysis of the setCSSEffects() method: When the mouse moves over or clicks on the button, due to the obstruction of the Flash button, the css “:hover”, “:active” and other pseudo-classes that copy the button itself may be Invalid. The setCSSEffects() method solves this problem. First we need to change the pseudo class into a class, such as:

The code is as follows:

// Need to change “:hover” to the following “.hover”

3. Analysis of the getHTML() method: If you want to instantiate Flash yourself without using the Zero Clipboard attachment method, then this method can help. It accepts two parameters, namely the width and height of Flash. What is returned is the HTML code corresponding to Flash. For example:
var html = clip.getHTML(150, 20);

This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/629641

author: admin

Previous article
Next article

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Contact us


Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top