<p>充值码:
<span id="czm">fghjklkjh</span>
<i class="iconfont iconfuzhi" id="copyText" onclick="copyText();"></i>
</p>
<script>
//复制充值码
function copyText(){
let range = document.createRange()
range.selectNodeContents(document.getElementById('czm'));
let selection = document.getSelection()
selection.removeAllRanges()
selection.addRange(range)
document.execCommand('Copy')
}
</script>
js 文本复制
最新推荐文章于 2024-07-06 16:47:02 发布