Home > Web Front-end > JS Tutorial > body text

Implementation method of zeroclipboard single copy button and multiple copy buttons_javascript skills

WBOY
Release: 2016-05-16 16:44:47
Original
1945 people have browsed it

Zeroclipboard is a cross-browser library class that uses Flash for copying, so it can run as long as the browser has Flash installed, and is more flexible than IE's document.execCommand("Copy").

zeroclipboard download address: http://www.jb51.net/jiaoben/24961.html

zeroclipboard implements multi-browser copy to pasteboard function (single copy button and multiple copy buttons). For a better user experience, the content of text boxes in many websites now only needs to click the copy button, so that the content can be copied to Paste board;

For compatibility reasons, it is basically implemented through zeroclipboard. First, download zeroclipboard, unzip and put ZeroClipboard.js, ZeroClipboard.swf, and ZeroClipboard10.swf ("for flash10") into the project. You can Load swf through ZeroClipboard.setMoviePath( '/ZeroClipboard.swf' ) method;
The following is the compiled code (also compiled through online search)

(single copy button):

html:

Copy code The code is as follows:

Copy


Multiple copy buttons:

Copy code The code is as follows:
copy
Copy
Copy


Note: clip.setText( $("#copy_txt" id).val() ); If you want to get the content in a div, generally use clip.setText( $("#copy_txt" id).text() ) ;or clip.setText( $("#copy_txt" id).html() );

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!