Return to Snippet

Revision: 3701
at September 3, 2007 14:55 by scriptmakingcom


Initial Code
<SCRIPT language="JavaScript">
function OnSubmitForm()
{
  if(document.pressed == 'Insert')
  {
   document.myform.action ="insert.html";
  }
  else
  if(document.pressed == 'Update')
  {
    document.myform.action ="update.html";
  }
  return true;
}
</SCRIPT>

<FORM name="myform" onSubmit="return OnSubmitForm();">

<INPUT TYPE="SUBMIT" name="Operation" onClick="document.pressed=this.value" VALUE="Insert">

<INPUT TYPE="SUBMIT" name="Operation" onClick="document.pressed=this.value" VALUE="Update">

</FORM>

Initial URL
http://www.javascript-coder.com/html-form/html-form-action.phtml

Initial Description

                                

Initial Title
How to switch the action field in an HTML form dynamically

Initial Tags
form, forms

Initial Language
JavaScript