我想試試這個DEMO通過使用ZeroClipboard將文本複製到剪貼板。我有一個本地文件夾與index.html,ZeroClipboard.js和ZeroClipboard.swf int它。 但它不工作:ZeroClipboard - 將文本複製到剪貼板不起作用
<html>
<body>
<script type="text/javascript" src="ZeroClipboard.js"></script>
<script type="text/javascript">
//set path
ZeroClipboard.setMoviePath('ZeroClipboard.swf');
//create client
var clip = new ZeroClipboard.Client();
//event
clip.addEventListener('mousedown', function() {
clip.setText(document.getElementById('box-content').value);
});
clip.addEventListener('complete', function (client, text) {
alert('copied: ' + text);
});
//glue it to the button
clip.glue('copy');
</script>
<textarea name="box-content" id="box-content" rows="5" cols="70">
The David Walsh Blog is the best blog around! MooTools FTW!
</textarea>
<br />
<br />
<p>
<input type="button" id="copy" name="copy" value="Copy to Clipboard" />
</p>
</body>
</html>
你們是不是在'localhost'或者只是雙擊打開文件?它應該在您的案例中的服務器'localhost'上。 – Jashwant