/ Published in: JavaScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<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>
URL: http://www.javascript-coder.com/html-form/html-form-action.phtml