首页 > 代码库 > 点击复制链接

点击复制链接

HTML:
<a href="javascript:void(0)" data-clipboard-text="http://midaijihua.com" class="copy">邀请好友</a>
JS:
if ($(‘.copy‘).length) {
var client = new ZeroClipboard(
$(‘.copy‘),
{moviePath: ‘/static/themes/plan/yangjing/js/ZeroClipboard.swf‘}
);

client.on(‘complete‘, function (client, args) {
alert("复制成功: " + args.text);
});
} else {
window.location.reload();
}

点击复制链接