Well, the best way to do it is the modern "unobtrusive JavaScript" scheme.
Code:
<form id="Form1" runat="server">
<asp:button id="Button1" Text="Something" AutoPostBack="False" />
<asp:button id="Button2" Text="Whatever" AutoPostBack="False" />
...
</form>
<script type="text/javascript">
(
function( ) /* anonymous master function */
{
// form not needed for this example, but this is what you could use:
var form = document.getElementById("<%=Form1.clientID %>");
// for the buttons:
document.getElementById("<%=Button1.clientID %>").onclick = program;
document.getElementById("<%=Button2.clientID %>").onclick = program;
function program( )
{
// inside this function, you can refer to the button via this. Example:
var buttonValue = this.value; // gets the ASP.Net TEXT property
...
}
} // end of master anonymous function
)(); // self-invoke anonymous function
</script>
</body><!-- notice the placement of the script! just before the body's end -->
</html>
CAUTION: If the button is set to do an autopostback, then you can't just assign to the onclick property, as shown. Instead, you would need to use attachEvent (for older MSIE) and/or addEventListener (for newer MSIE and all other browsers). If you do just assign to onclick, as shown above, that would disconnect the autopostback and *ONLY* execute your client-side JS code.