<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>测试有效
评论列表:
小杰,好刀法,转发一下
这个兼容性不好
回复了Flyer:大佬给我发一段好的,谢谢
୧(๑•̀⌄•́๑)૭不错小杰