第一种方法:
<script type="text/javascript">
function CopyRegisterPath() {
var btn = document.getElementById("<%=txtRegisterPath.ClientID%>");
clipboardData.setData('text', btn.value);
}
</script>
<asp:TextBox ID="txtRegisterPath" runat="server" Enabled="false"></asp:TextBox>
<input type="button" id="btnCopyRegisterPath" οnclick="CopyRegisterPath()" value="复制"/>
第二种方法:
this.btnCopy.Attributes.Add("onclick", @"javascript:window.clipboardData.setData('Text','" + copyMessage + "')");