HTML 点击复制
<!DOCTYPE html> <html> <head> <script type="text/javascript"> function copy() { var e = document.getElementById("copy"); e.select(); // 选择对象 document.execCommand("Copy"); // 执行浏览器复制命令 alert("复制成功!"); } </script> </head> <body> <textarea id="copy">123456</textarea> <input type="button" onclick="copy();" value="点击复制"></input> </body> </html>