<body>
<button type="button" onclick="copyImg()">复制图片</button>
</body>
<script>
function copyImg(){
let result=this.getImg();
console.log(result)
function handle(e) {
e.clipboardData.setData('text/html', result);
alert('复制成功');
e.preventDefault();
}
}
function getImg() {
var list=new Array()
list[0]='http://img.zcool.cn/community/01ca2857e4ea7b0000012e7eb2e752.jpg@900w_1l_2o_100sh.jpg';
var content = '';
content += '<span style="display: block">';
list.forEach(function (v) {
content += '<img src="' + v + '">';
})
content += '</span>';
return content;
}
</script>
复制图片到粘贴板
最新推荐文章于 2024-05-15 14:54:03 发布