时间:2021-07-01 10:21:17 帮助过:4人阅读
<script type="text/javascript">
function copyData() {
var copyText = document.getElementById("ctl00_cpRight_txtUrl").value;
window.clipboardData.setData("Text",copyText);
}
</script>
<asp:TextBox ID="txtUrl" runat="server" Height="30px" Width="349px"></asp:TextBox>
<input id="btnCopyUrl" type="button" value="复制URL到粘贴板" onclick="copyData()" />
注:ctl00_cpRight_txtUrl这个ID其实是txtUrl生成页面后自动生成的ID。