//复制到剪切板 function copyToClipboard(text) { var input = document.createElement('input'); input.setAttribute('readonly', 'readonly'); input.setAttribute('value', text); document.body.appendChild(input); input.select(); input.setSelectionRange(0, 9999); document.execCommand('Copy'); input.remove(); if (document.execCommand('Copy')) { alert("复制成功!"); } }