js代码:
function copyUrl2() {
var Url2 = document.getElementById("ctl02_ContentPlaceHolder1_txtLink");
Url2.select(); // 选择对象
document.execCommand("Copy"); // 执行浏览器复制命令
layer.msg("已复制好,可贴粘。", {icon: 1, time: 1000});
}
html代码:
<input name="ctl02$ContentPlaceHolder1$txtLink" type="text" id="ctl02_ContentPlaceHolder1_txtLink" class="link-input pull-left" style="width:250px;">
<input id="d_clip_button" type="button" onclick="copyUrl2()" class="MP-button pull-left" value="复制" data-clipboard-target="#ctl02_ContentPlaceHolder1_txtLink">