ZeroClipboard 的官網 點這裏,github地址 點這裏。html
事例以下:git
在引入 ZeroClipboard.js 以後,github
<button id="clip_button" data-clipboard-target="fe_text">複製到剪貼板</button>
fe_text 爲文本的標籤的 idspa
// 定義一個新的複製對象 var clip = new ZeroClipboard( document.getElementById("clip_button"), { moviePath: "ZeroClipboard.swf" }); // 複製內容到剪貼板成功後的操做 clip.on( 'complete', function(client, args) { alert("複製成功,複製內容爲:"+ args.text); });