0
我想知道爲什麼它做的一切,在ZeroClipboard - 複製到剪貼板的問題。
只是沒有實際的文本拷貝該行:client.on( 'dataRequested',函數(客戶端,參數){
$("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);
});
});
爲什麼要在每次點擊時設置全局變量 – Charlie