Click the button to copy the contents of the text box

HighlightAll function () {
var target = document.getElementById ( "txtLecturerAndStuName");
target.select (); // select the text
document.execCommand ( "Copy"); // copy command to perform a browser
alert ( "Copied good, can be attached stick ");
}

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

Guess you like

Origin www.cnblogs.com/xiaoyunpeng/p/12067769.html