<FORM NAME="MyFirstForm">
<INPUT TYPE=TEXT NAME=MyName><BR>
<INPUT TYPE=BUTTON VALUE="Add" ONCLICK="Add();">
<INPUT TYPE=BUTTON VALUE="Delete" ONCLICK="Delete();">
</FORM>

 

<SCRIPT LANGUAGE="JavaScript">
<!--
function Add()
{
// alter the action and submit the form
document.MyFirstForm.action = "AddName.asp";
document.MyFirstForm.submit();
}

function Delete()
{
// alter the action and submit the form
document.MyFirstForm.action = "DeleteName.asp";
document.MyFirstForm.submit();
}
// -->
</SCRIPT>

Change form action and submit form using one click.

<script>
function submit_form(){

var pay_option = $("input[name=payment_option]:checked").val();

if(pay_option=='cheque'){
document.payment_form.action = "url1";
}
else if(pay_option=='eft'){
document.payment_form.action = "url2";
}
else if(pay_option=='paypal'){
document.payment_form.action = "paypal_url";
}
else{
return false;
}
document.payment_form.submit();

}
</script>

Advertisements