by Davo Smith.
I'd probably pass via the 'attributes' paramater, assuming 'submit' buttons have an 'attributes' paramater - I'd have to check. Assuming there is an attributes paramater, it'd probably look like:
array('onclick' => 'my_onclick_function()')
You would then need to add the javascript to the page (either via an 'html' form element, or loaded onto the page that outputs the form).