I do this on the server-side. That is, the form always submits to the same target, but I have a server-side script that is responsible for redirecting to the appropriate location depending on what button was pressed.
If you have multiple buttons, such as
<form action="mypage" method="get">
<input type="submit" name="retry" value="Retry" />
<input type="submit" name="abort" value="Abort" />
</form>
(note, I used GET, but it works for POST too)
Then you can easily determine which button was pressed - if the variable 'retry' exists and has a value then retry was pressed, and if the variable 'abort' exists and has a value then abort was pressed. This knowledge can then be used to redirect to the appropriate place.
This method needs no Javascript.
Note that some browsers are capable of submitting a form without pressing any buttons (by pressing enter). Non-standard as this is, you have to account for it, by having a clear 'default' action and activating that whenever no buttons were pressed.