function CopyAddress(btn) { var AddressStr=" "; var $btn = $(btn); var tr = $btn.parent().parent(); var trs = tr.siblings(); var tr1 = $(trs.get(0)); var td1 = $(tr1.children().get(1)); var tr2 = $(trs.get(1)); var td2 = $(tr2.children().get(1)); AddressStr = td1.text() + td2.text(); //复制操作 var oInput = document.createElement('input'); oInput.value = AddressStr; document.body.appendChild(oInput); oInput.select(); // 选择对象 document.execCommand("Copy"); // 执行浏览器复制命令 oInput.className = 'oInput'; oInput.style.display='none'; var mylay = layer.open({ content: "复制成功", icon: 1, title: [ '提示', 'background-color:#f90; color:#fff;' //标题样式 ] }) setTimeout(function () { layer.close(mylay); }, 2000); }