点击TextBox复制其中内容

点击TextBox复制其中内容

<script>
 function copyCode(o)
 {
  o.select();
  var js=o.createTextRange();
  var cp js.execCommand("Copy");
  alert("图片地址已复制到剪贴板.");
 }
 function inplast(ob)
 {
  var obj=findObj(ob); if (obj) {
  obj.select();js=obj.createTextRange();js.execCommand("Copy");}
 }

</script>

<asp:TextBox ID="sex1" onclick="copyCode(this);" Runat="server" ></asp:TextBox>
<asp:TextBox id="sex2" onclick="inplast('From1');" Runat="server"></asp:TextBox>

附件:
一些常用的exeCommand
<textarea id=ta cols=24 rows=6>study by blueidea HOT.</textarea>
<button onclick=ta.focus();document.execCommand("selectall")>select</button>
<button onclick=document.execCommand("copy")>copy</button>  
<button onclick=document.execCommand("cut")>cut</button>
<button onclick=ta.focus();document.execCommand("paste")>paste</button>
<button onclick=document.execCommand("open")>open</button>
<button onclick=document.execCommand("saveas")>saveas</button>
<input type=button value=刷新 name=refresh onclick="window.location.reload()">
<INPUT name=Submit onclick=history.go(1) type=submit value=前进> 
<INPUT name=Submit2 onclick=history.go(-1) type=submit value=后退>
<INPUT name=Button onclick='window.location = "view-source:" + window.location.href'  type=button value=查看源文件>