js复制到剪切板 onclick(text,context)直接复制
function copyText(text, context=''){ // text: 要复制的内容,context 弹出的 提醒
var tag = document.createElement('input');
tag.setAttribute('id', 'cp_hgz_input');
tag.value = text;
document.getElementsByTagName('body')[0].appendChild(tag);
document.getElementById('cp_hgz_input').select();
document.execCommand('copy');
document.getElementById('cp_hgz_input').remove();
if(context=='') {alert('复制成功')}else{alert(context) }
}