Sorry, here is the full working code. You can just use one function for both the buttons.
The inportent part is the form name property (in code myform.submit() so the form name and id has to be myform).
There is an if statement in the script on the name of the button, depending on the name of the button the action of myform will be set.
Anyway here is the code:
<script>
function mysubmitfunction(objButton) {
var oktosubmit = true;
// do some client checking here if all the form elements contain valid data.
// a form element can be addressed like this:
// eval('myform.myelement').value
// if you cannot submit because some data in the form is not valid
// you have to set the oktosubmit to false
if(oktosubmit) {
if(objButton.name=="sub1"

{
myform.action='sub1.asp';
}
else {
myform.action='sub2.asp';
}
myform.submit();
}
else {
// to prevent the user to click on the submit button twice really fast and submit the page twice
// the button was disabled but because the form cannot be
// submitted we have to tell the user to correct his/her input
// and give the user the opportunity to submit again.
objButton.enabled = true;
return false;
}
}
</script>
<form name=myform id=myform>
<input type=text>
<input type=button onclick="mysubmitfunction(this);" name="sub1" value="submit1">
<input type=button onclick="mysubmitfunction(this);" name="sub2" value="submit2">
</form>