Of course, you just add the onClick event, all JS codes are executed before the postback.
If the code is intended for verification, and you decide that you do not want to submit, you can return false and it will not publish.
<asp:Button OnClientClick="" />
Sruly
source share