Excellent question. No, there is no way to access the buttons from code, sadly. But you can do what you want by explicitly removing the standard buttons from the alert (with alert(..., buttons=[])
and then including your own buttons on your custom content form.
You can use the "x-close-alert"
event to close the alert and return a particular value when your custom buttons are clicked.
See the documentation of alerts for full details.
Hope that helps!