js复制span内容到剪切板
<span id="copyText">123456</span>
<span onclick="copy();">复制</span>
function copy() {
var text =document.getElementById("copyText").innerText;
var input = document.createElement('input'); input.setAttribute('id', 'copyInput');
input.setAttribute('value', text);
document.getElementsByTagName('body')[0].appendChild(input);
document.getElementById('copyInput').select();
document.execCommand('copy'))
alertinfo('复制成功');
document.getElementById('copyInput').remove();
}