js 执行复制到剪切板

function copyUrl2()    {        var Url2=document.getElementById("show_id").innerText;        var oInput = document.createElement('input');        oInput.value = Url2;        document.body.appendChild(oInput);        oInput.select(); // 选择对象        document.execCommand("Copy"); // 执行浏览器复制命令        oInput.className = 'oInput';        oInput.style.display='none';        alert('复制成功');    }
这里是要被复制的内容

简单方便:不用太复杂

发表评论
留言与评论(共有 0 条评论) “”
   
验证码:

相关文章

推荐文章