Copy zeroclipboard to clipboard flash

Source: Internet
Author: User

The implementation steps are as follows:
1-reference the file. After the download, two core files, zeroclipboard.js and zeroclipboard.swf, will be obtained, and one of them will be referenced in the project.
<SCRIPT type = "text/JavaScript" src = "http://www.cnblogs.com/Scripts/ZeroClipboard/ZeroClipboard.js"> </SCRIPT>

2-load the zeroclipboard object and implement the copy function.CopyCodeThe Code is as follows: // this step is very important. Set the Reference Path of the flash file.
Zeroclipboard. setmoviepath ('HTTP: // www.cnblogs.com/scripts/zeroclipboard/zeroclipboard.swf ');
// Create a zeroclipboard object
Clip = new zeroclipboard. Client ();
Clip. sethandcursor (true );
// Load the event. In the Mouseover event, upload the content to be copied to the flahs file for storage.
Clip. addeventlistener ('mouseover', function (client ){
Clip. settext ($ ('# indinfo'). Val ());
});
// A dialog box is displayed after the copy is successful.
Clip. addeventlistener ('complete', function (client, text ){
Alert ("Copied text to clipboard: \ n" + text );
});
// Specifies the object that implements the copy function.
Clip. Glue ('copy ');
// The following is the HTML object used
<% = Html. Hidden ("indinfo", viewdata ["indinfoformat"]. safestring () %>

<Input type = "button" value = "Copy to clipboard" id = "copy" name = "copy"/>

3-for local debugging and flash-based security mechanisms, some settings are required.
Http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04a.html
Enter the physical path of the Flash file on the webpage.

Http://www.jb51.net/jiaoben/28907.html

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.