faqts : Computers : Programming : Languages : JavaScript : Forms

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

10 of 14 people (71%) answered Yes
Recently 7 of 10 people (70%) answered Yes

Entry

How can I change the action attribute of the form tag base on which submit button is selected?

Oct 23rd, 2002 15:33
Amit Arora, Ola Nissinen,


You can try this ...

<form name='frmGeneral' action='script.php' method='post'>

<input type='submit' name='Submit1' value='Submit1' 
onclick="document.frmGeneral.action='script2.php';">

<input type='submit' name='Submit2' value='Submit2' 
onclick="document.frmGeneral.action='script3.php';">

</form>