<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
</head>
<body>
<textarea name="" id="txt" >内容</textarea>
<input type="button" onclick="fu()" value="点击复制"></input>
<script>
let txt = document.getElementById('txt');
function fu(){
txt.select();
document.execCommand('copy');
alert("内容复制成功!!!");
}
</script>
</body>
</html>
js小功能(复制按钮)
最新推荐文章于 2024-02-22 19:20:54 发布