标签:http 使用 io for ar cti div html
html :
<body>
<div class="demo-area">
<label for="copy-input">输入要复制到剪切板的文字:</label><br>
<textarea id="copy-input" cols="30" rows="10"></textarea><br>
<button id="copy-button">复制到剪贴板</button><br>
</div>
<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script>
<script src="path/to/ZeroClipboard.js"></script>
</body>
</html>
js:
//配置ZeroClipboard.swf ZeroClipboard.config({ swfPath: ‘./vendor/ZeroClipboard.swf‘ }); //初始化 var client = new ZeroClipboard(document.getElementById("copy-button")); client.on("ready", function(readyEvent) { client.on("copy", function(event) { var clipboard = event.clipboardData; var copyText = $(‘#copy-input‘).val(); clipboard.setData("text/plain", copyText); // 将内容添加到剪切板 }); });
将内容复制到剪切板兼容主流浏览器的解决方案,布布扣,bubuko.com
标签:http 使用 io for ar cti div html
原文地址:http://www.cnblogs.com/ake520/p/3892599.html