Posted By

scriptmakingcom on 09/03/07


Tagged

form action forms Switch multiple


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

vali29


How to switch the action field in an HTML form dynamically


 / Published in: JavaScript
 

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

  1. <SCRIPT language="JavaScript">
  2. function OnSubmitForm()
  3. {
  4. if(document.pressed == 'Insert')
  5. {
  6. document.myform.action ="insert.html";
  7. }
  8. else
  9. if(document.pressed == 'Update')
  10. {
  11. document.myform.action ="update.html";
  12. }
  13. return true;
  14. }
  15. </SCRIPT>
  16.  
  17. <FORM name="myform" onSubmit="return OnSubmitForm();">
  18.  
  19. <INPUT TYPE="SUBMIT" name="Operation" onClick="document.pressed=this.value" VALUE="Insert">
  20.  
  21. <INPUT TYPE="SUBMIT" name="Operation" onClick="document.pressed=this.value" VALUE="Update">
  22.  
  23. </FORM>

Report this snippet  

You need to login to post a comment.