a bit of a hack and unsuported...
i injected the below into a html field on the record via a worklfow - essentially doing what you're chasing.
'
<script>
var buttonid = "custpageworkflow1639"
document.getElementById(buttonid).onclick=function(event){
//somecode
NS.Workflow.buttonClick(buttonid);
}
</script>
'