js 一键复制

function copyURL(id){

        var siteId=$("#siteId").val()

        var oInput = document.createElement('input');

        if (siteId==1) {

   oInput.value = location.protocol+"//"+location.host+"/replyDetails.jspx?conId="+id;

        }else {

oInput.value = location.protocol + "//" + location.host + "/replyDetailsZiZhan.jspx?conId=" + id;

        }

        document.body.appendChild(oInput);

        oInput.select(); // 选择对象

        document.execCommand("Copy"); // 执行浏览器复制命令

        oInput.className = 'oInput';

        oInput.style.display='none';

        alert('复制成功');

    }

猜你喜欢

转载自www.cnblogs.com/powangxu/p/10315270.html
今日推荐