[JAVASCRIPT] Implementation page copied to computer clipboard

Source: Internet
Author: User

First, the method

Party 1:

Window.clipboarddata unfortunately does not support chrome, Chrome will be prompted to find the Clipboarddata object

Party 2: Using the Zeroclipboar.js plugin written by foreign Daniel, the principle is to use Flash plug-ins to cover the response copied DOM objects

<!--here is the HTML code section -<textareaID= "Content"rows= "Ten"cols= "$">Here are the things to copy</textarea><inputID= "Copy"type= "button"value= "Copy"></Body><Scriptsrc= "<?php echo yii::app ()->baseurl;? >/resources/libs/js/zeroclipboard/zeroclipboard.js "></Script><Scriptlanguage= "JavaScript">    varClip= NewZeroclipboard (document.getElementById ('Copy')); Clip.on ({" Ready": function() {alert ("load Complete!"); },        "Copy" : function(e) {alert ('Copy'); E.clipboarddata.setdata ("Text/plain", "here is the plain text data for replication");},        "aftercopy": function(e) {alert ('Copy complete');} });</Script>

[JAVASCRIPT] Implementation page copied to computer clipboard

Related Article

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.