Chances are you can’t get the control with getElementById… especially if you put HtmlInputHidden runat=”server”. The reason is because .net will add some stuff in front of the ID in order to make the control unique throughout the page. When Todd put myTextBox.Attributes.Add(“ID”, “TextBox1”), the ID of the textbox is added and not handled by .net framework (I think), that’s why javascript can find the control at client side…
A general rule of thumb, if you assign the ID in server side, and you want to access the control at client side, use ClientID… the framework will give you the correct value…