[关闭]
@sammffl 2016-03-04T08:34:05.000000Z 字数 388 阅读 799

ZeroClipboard.js(浏览器复制文本到剪贴板)

javascript插件


用flash来操作复制到剪贴板

github:https://github.com/zeroclipboard/ZeroClipboard

  1. <script src="dist/ZeroClipboard.min.js"></script>
  1. var client = new ZeroClipboard(document.getElementById("btn"));
  2. client.on('ready', function (readyEvent) {
  3. client.on('aftercopy', function (event) {
  4. alert('copied text to clipboard: ' + event.data["text/plain"]);
  5. });
  6. });
  1. //复制内容
  2. client.setText( "Copy me!" );
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注