Imagine that you have a text control like this:
<asp:TextBox ID="txtName" runat="server />
I see all kinds of examples that get the control valuelike this:
document.forms[0].txtName
---or---
document.getElementByID("txtName")
While it might work in simple situations, it won't work all of the time. How about this:
document.forms[0].<%=txtName.ClientID%>
---or---
document.getElementByID("<%=txtName.ClientID%>")
by referencing the txtName.ClientID property, you get the client id of the control. The reason this is important is that if the control is contained within another container, the name is mangled to generate a unique value, which is more than the simple name of the control.