Example shows use with onclick event of HTML control. Note alternate usage easily accomplished with asp button control onClientClick event as well:
publicvoid Page_Load(Object sender, EventArgs e)
{
// same code as shown in above example....
// add to OnClientClick property or simply assign in code as below
this.Button1.OnClientClick = "doClick()";
}
<asp:ButtonID="Button1"runat="server"
Text="Press Me"/>