也就是<form id="Form1" method="post" runat="server">
中的那一个id,最好告诉我如何获得form1的引用

解决方案 »

  1.   

    something like the following:string GetHtmlFormID(Control c)
    {
      string sID = null;
      if (c is HtmlForm)
        sID =  c.ID;  //or c.ClientID or c.UniqueID
      else foreach (Control child in c.Controls)
         { 
            sID = GetHtmlFormID(child);
            if (sID != null)
              break;
          }  return sID;
    }string sID = GetHtmlFormID(this); //or GetHtmlFormID(Page);
      

  2.   

    alert(document.forms.length);
    for(var i = 0; i < document.forms.length; i ++)
    {
    alert(document.forms[i].id);
    }