OnClick vs OnClientClick for an asp:CheckBox?
问题 Does anyone know why a client-side javascript handler for asp:CheckBox needs to be an OnClick="" attribute rather than an OnClientClick="" attribute, as for asp:Button? For example, this works: <asp:CheckBox runat="server" OnClick="alert(this.checked);" /> and this doesn't (no error): <asp:CheckBox runat="server" OnClientClick="alert(this.checked);" /> but this works: <asp:Button runat="server" OnClientClick="alert('Hi');" /> and this doesn't (compile time error): <asp:Button runat="server"