JavaScript has a few built-in methods and properties for dealing with forms. Three of them are especially important:
You can submit a form by using the submit() method. To submit the first form on
the page, do
document.forms[0].submit()
Please note that when a form is submitted by JavaScript the onsubmit event handler
is never executed. To reset the form, do
document.forms[0].reset()
I assume, but have not tested, that the onreset event handler isn’t executed
either if you reset the form through JavaScript. Finally, you can change the ACTION of a form if you want to:
document.forms[0].action = ‘the_other_script.pl’;
This can come in very handily if a form has to be submitted to another script in some
cases.