<!DOCTYPE html>
<html>
<head>
<title>点击复制</title>
</head>
<style>
#test{
background-color: #FD5643;
}
</style>
<body>
<textarea id="test" type="text" name="" value="this is test."></textarea>
<button onclick="Copy()">点击复制</button>
</body>
<script type="text/javascript">
function Copy() {
var content = document.getElementById('test');
content.select();
document.execCommand('Copy');
alert('复制成功');
}
</script>
</html>
简单的东西自己用