【发布时间】:2014-03-02 11:25:27
【问题描述】:
我想知道为什么它会做所有事情,而不是实际的文本副本
那一行:client.on('dataRequested', function(client, args) {
$("body").on("click","#bonus-copy",function(){
var _globalConfig = {
swfPath: "js/ZeroClipboard.swf",
trustedDomains: [window.location.host],
cacheBust: true,
forceHandCursor: false,
zIndex: 999999999,
debug: false,
title: null,
autoActivate: true,
hoverClass: "zeroclipboard-is-hover",
activeClass: "zeroclipboard-is-active",
trustedOrigins: null,
allowScriptAccess: null,
useNoCache: true,
moviePath: "ZeroClipboard.swf"
};
var client = new ZeroClipboard();
client.on('dataRequested', function(client, args) {
var text = document.getElementById('copy-text').value;
var windowsText = text.replace(/\n/g, '\r\n');
client.setText(windowsText);
alert(windowsText);
});
});
【问题讨论】:
-
为什么每次点击都要设置全局变量
标签: javascript jquery zeroclipboard