通过js实现复制到剪贴板功能,测试有效......,详情看本文版权。
<input type="text" id="content" value=""/> <button type="button" onClick="copyUrl2()">复制短链接</button> <script> function copyUrl2(){ var urlresult=document.getElementById("content"); urlresult.select(); // 选择对象 document.execCommand("Copy"); // 执行浏览器复制命令 alert("已复制好,可贴粘。"); } </script>
发表评论