日期:2014-05-16  浏览次数:20317 次

ZeroClipboard实现复制功能,怎么都实现不了,这是为什么呢?
最近要实现个复制功能,网上大家都说用ZeroClipboard可以实现,我找了N多的例子,直接运行不行,照着https://github.com/zeroclipboard/ZeroClipboard下面的例子自己写一个吧,也不行,都快疯了,大家来帮帮忙吧。下面是我照着例子写的代码,大家帮忙看看
test.html
<html>
  <body>
    <button id="copy-button" data-clipboard-text="Copy Me!" title="Click to copy me.">Copy to Clipboard</button>
    <script src="ZeroClipboard.js"></script>
    <script src="main.js"></script>
  </body>
</html>

main.js
// main.js
var clip = new ZeroClipboard( document.getElementById("copy-button"), {
  moviePath: "ZeroClipboard.swf"
} );

clip.on( 'load', function(client) {
  // alert( "movie is loaded" );
} );

clip.on( 'complete', function(client, args) {
  this.style.display = 'none'; // "this" is the element that was clicked
  alert("Copied text to clipboard: " + args.text );
} );

clip.on( 'mouseover', function(client) {
  // alert("mouse over");
} );

clip.on( 'mouseout', function(client) {
  // alert("mouse out");
} );

clip.on( 'mousedown', function(client) {

  // alert("mouse down");
} );

clip.on( 'mouseup', function(client) {
  // alert("mouse up");
} );
ZeroClipboard

------解决方案--------------------
网站没有发布吧。。本地测试flash有安全问题的,需要配置过flash的安全