<div>
        <input type="text" name="guanfangaddress" />
         <span  >复制</span>
</div>

<script type="text/javascript">
    function copyArticle(event) {        
        const range = document.createRange();        
        range.selectNode(document.getElementById('guanfangaddress'));         
        const selection = window.getSelection();        
        if(selection.rangeCount > 0) selection.removeAllRanges();        
        selection.addRange(range);        
        document.execCommand('copy');        
        alert("复制成功!");      
    }       
    document.getElementById('copyBT').addEventListener('click', copyArticle, false);
</script>

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-09
  • 2022-12-23
  • 2021-12-27
  • 2021-05-22
  • 2021-12-24
猜你喜欢
  • 2022-12-23
  • 2021-11-19
  • 2022-12-23
  • 2022-12-23
  • 2021-11-15
  • 2022-12-23
相关资源
相似解决方案