1. 程式人生 > >js複製內容到貼上板

js複製內容到貼上板

function copyUrl(){
        var oInput = document.createElement('input');
        oInput.value = "https://blog.csdn.net/xiaonuanli/article/details/80983721";
        document.body.appendChild(oInput);
        oInput.select(); // 選擇物件
        document.execCommand("Copy"); // 執行瀏覽器複製命令
        oInput.style.display='none';
        alert('連結已複製到貼上板');
    }