html点击复制功能
2019-06-25 本文已影响2人
啊试
<!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">https://blog.csdn.net/yuzsmc</textarea>
<input type="button" onclick="copy();" value="点击复制"></input>
</body>
</html>