欢迎加入EUCMS官方QQ交流群,与更多EUCMS用户一起讨论,共同发财!
QQ群:1222386
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>复制微信号</title>
<script type="text/javascript">
function copyText() {
var text = document.getElementById("text").innerText;
var input = document.getElementById("input");
input.value = text; // 修改文本框的内容
input.select(); // 选中文本
document.execCommand("copy"); // 执行浏览器复制命令
alert("复制成功");
}
</script>
</head>
<body>
<style type="text/css">
body {font-size:1.5em}
.wrapper {position: relative;}
#input {position: absolute;top: 0;left: 0;opacity: 0;z-index: -10;}
</style>
<div class="wrapper">
<p id="text">EUCMS</p>
<textarea id="input">复制微信号</textarea>
<button onclick="copyText()">点我复制微信号</button>
</div>
<body>
</body>
</html>