这里需要三个插件,分别是:
jquery.js
ZeroClipboard.js
ZeroClipboard.swf
祝你好运!
复制代码 代码如下:
<meta charset="utf-8" />
<button id="d_clip_button" data-clipboard-target="fe_text" >点击复制</button>
<input id="fe_text" value="Testing text." />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="ZeroClipboard.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
ZeroClipboard.setDefaults({
moviePath: "ZeroClipboard.swf"
});
var clip = new ZeroClipboard($("#d_clip_button"));
clip.on("load", function(client) {
console.log("ZeroClipboard.");
client.on("complete", function(client, args) {
console.log("内容己复制 :" + args.text);
});
});
});
</script>
时间: 2024-10-27 23:39:48