前台:     function test1(x,y,m,n)
    {
        document.getElementById(x).value=y;
        document.getElementById(m).innerHTML=n;
        return true;
    }后台: 
                string TH1 = Request.QueryString["TH1"].ToString();
                string TH2 = Request.QueryString["TH2"].ToString();
                Country countryH1 = CountryManager.GetCountryInfoById(Convert.ToInt32(TH1));
                Country countryH2 = CountryManager.GetCountryInfoById(Convert.ToInt32(TH2));                divh1.InnerHtml = "<span id=\"spH1\" onclick=\"javascript:test1('tgh2','" + Convert.ToInt32(TH1) + "','divgh2','" + countryH1.CountryName + "')\">" + countryH1.CountryName + "</span>";
                divh2.InnerHtml = "<span id=\"spH2\" onclick=\"javascript:test1('tgh1','" + Convert.ToInt32(TH2) + "','divgh1','" + countryH2.CountryName + "')\">" + countryH2.CountryName + "</span>";按钮:在保存按钮下取出每个span中的值,用于保存数据

解决方案 »

  1.   

    隐藏控件:<input type="hidder" id="inputHd" ruant="server">var Arrayspan= $("#div1").find("span");
    $(Arrayspan).ench(function(entryIndex,entry){
       $("inputHd").append(entry);
    });.cs
    this.inputHd.value
      

  2.   

    Regex reg = new Regex(@"(?i)(?<=<span.*?id=""s"".*?>)[^<]+(?=</span>)");
      MatchCollection mc = reg.Matches(html);
      foreach (Match m in mc)
      {
      Console.WriteLine(m.Groups[0].ToString() );
      }