To each Button add OnClientClick event
<script type="text/javascript">
function GetText(btn) {
alert(btn.value);
return false;
}
</script>
<asp:Button ID="Button2" runat="server" Text="1" OnClientClick = "return GetText(this)" />
<asp:Button ID="Button1" runat="server" Text="2" OnClientClick = "return GetText(this)" />