function copyTextToClipboard(text) {
var textArea = document.createElement("textarea");
textArea.style.background = 'transparent';
textArea.value = text;
document.body.appendChild(textArea);
textArea.select();
try {
var successful = document.execCommand('copy');
var msg = successful ? 'successful' : 'unsuccessful';
} catch (err) {
console.log('Oops, unable to copy');
}
document.body.removeChild(textArea);}
js拷贝指定内容到剪切板
程序员文章站
2022-06-16 10:33:45
...
上一篇: Java深入了解数据结构中常见的排序算法
下一篇: 序列化与反序列化