84669 Lernen von Personen
152542 Lernen von Personen
20005 Lernen von Personen
5487 Lernen von Personen
7821 Lernen von Personen
359900 Lernen von Personen
3350 Lernen von Personen
180660 Lernen von Personen
48569 Lernen von Personen
18603 Lernen von Personen
40936 Lernen von Personen
1549 Lernen von Personen
1183 Lernen von Personen
32909 Lernen von Personen
js怎样实现ctrl + c 的复制功能?
业精于勤,荒于嬉;行成于思,毁于随。
<html> <head> <meta charset="UTF-8"> <title></title> <style type="text/css"> .text-input{ border: none; outline:medium; box-shadow: none; } .copy-id:focus{ border: none; } </style> </head> <body> <input readonly="readonly" class="copy-id text-input" type="text" value="12333333333"/> <button class="copy">复制</button> </body> <script type="text/javascript" src="http://cdn.bootcss.com/jquery/2.2.3/jquery.min.js"></script> <script type="text/javascript"> $('.copy').click(function () { $('.copy-id').select(); document.execCommand("copy",false,null); }) </script> </html>
这是点击按钮,实现复制
<input type="text" id="input"> <button onclick="copyFn()">点击</button> <script> function copyFn() { var e = document.getElementById("input"); e.select(); document.execCommand("Copy"); } </script>
keydown getSelection
见楼上就可以
这是点击按钮,实现复制
见楼上就可以