验证中...
语言: JavaScript
分类: Web开发技术
最后更新于 2018-06-14 10:08
Untitled-1.html
原始数据 复制代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<button type="button" onclick="copy()">复制</button>
<hr>
<textarea id="textarea1" cols="30" rows="10">
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Fuga, eum minima deserunt facere cupiditate ex fugiat dignissimos
unde cum commodi nulla minus sunt officia laudantium modi similique rerum? Aut, voluptatibus.
</textarea>
<textarea name="" id="" cols="30" rows="10"></textarea>
<script>
function copy() {
var textarea1 = document.getElementById('textarea1');
var str = textarea1.select();
document.execCommand('Copy');
// alert('已复制,可粘贴');
}
</script>
</body>
</html>

评论列表( 0 )

你可以在登录后,发表评论

搜索帮助