js 请求回来后复制内容

var http = window.location.protocol + '//' + window.location.host + "/preview.html?mark=";
var tag = document.createElement('input');
tag.setAttribute('id', 'cp_screenshot_input');
tag.value = http + 'id';
document.getElementsByTagName('body')[0].appendChild(tag);
document.getElementById('cp_screenshot_input').select();
document.execCommand('copy');
document.getElementById('cp_screenshot_input').remove();

 

posted @ 2022-02-24 11:21  本溢  阅读(64)  评论(0)    收藏  举报