There is a attribute so called onClientClick you have to set that on your button click.
<script type="text/javascript">
function func1() {
alert("the function called");
}
</script>
<asp:Button runat="server" Text="Button1" onclick="Unnamed1_Click" OnClientClick="func1()" CommandArgument="WithData"/>
One more thing to inform you is that if this fuction is returning false i.e return false; is coded in the function than the button would not cause to calle the server side event.