<!DOCTYPE html>
<html>
<head>
<title>JS点击图片了之后,执行复制操作,可用ctrl+v 进行粘贴</title>
</head>
<body>
<img src="https://g.csdnimg.cn/static/user-reg-year/2x/4.png">
<script type="text/javascript">
var img = document.getElementsByTagName('img')[0];
img.onclick = function (e){
var range = document.createRange();
range.selectNode(document.getElementsByTagName('img')[0]);
window.getSelection().addRange(range);
document.execCommand("Copy");
}
</script>
</body>
</html>