我直接在后台代码中给文本框赋值,也就是把地址栏的完整地址获得再赋值给文本框怎么做啊?
文本框后面有个“复制链接”的按钮,那再怎么复制列?

解决方案 »

  1.   

    1. 取得地址栏的完整地址
    String currentURL = Request.Url.AbsoluteUri;
      

  2.   

    String URL =Request.Url.ToString()参考
      

  3.   

    一、应用JavaScript代码获取:
    <script language="javascript">
    alert(document.location.href);
    </script>二、应用ASP代码获取:
    <%a=request.servervariables("server_name")%>
    <%b=request.servervariables("script_name")%>
    <%="http://"&a&b%>
      

  4.   

    2. 文本框后面有个“复制链接”的按钮,那再怎么复制列?<input id="Button" type="button" onclick="SelectCopy()" value="复制到粘帖板" />
    <asp:TextBox ID="TextBox1" runat="server" Width="594px"></asp:TextBox><script type="text/javascript" language="javascript">function SelectCopy() {
       if (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion >= "4.0")
       {
          document.getElementById('<% = TextBox1.ClientID %>').focus();
          document.execCommand('SelectAll');
          document.execCommand('Copy');
       }
       else
       {
          alert("Sorry, this only works for InternetExploder")
       }
    }
    有点缺陷,只支持IE~~