点击按钮复制文本框内容

function HighlightAll() {
var target = document.getElementById("txtLecturerAndStuName");
target.select();// 选择文本
document.execCommand("Copy"); // 执行浏览器复制命令
alert("已复制好,可贴粘。");
}

<asp:TextBox class="txtcontent" ID="txtLecturerAndStuName" MaxLength="200" runat="server"></asp:TextBox>
<input type="button" value="复制" onclick="HighlightAll()" />

猜你喜欢

转载自www.cnblogs.com/xiaoyunpeng/p/12067769.html