View Full Version : Change Form Action

07-02-2003, 10:31 AM

Ok, my knowledge is generally server-side, and even that is limited, so I need a little help with some JS if you can. Basically I want to change the action of the form if option 5 is selected on one of the drop-down menus. I have written the below code, but I think I may have over simplified it. The form tags include...


Any help would be much appreciated.

- - - - - - - - - -

function ChangeFormAction()
var srcElem = window.event.srcElement;
var action = formtags.action;

if(srcElem.value == 5)

07-02-2003, 11:05 AM
"id" is not the same thing with "name".

If you want to use:

var action = formtags.action

than give a name to your element, like <tag name="formtags">. You can keep the "id", if you need it in another function. The "id" and the"name" can have same values.

"id" is asociated with something like getElementById(id), which is a method to retrive an element straight by his "id", without mentioning the tree position in page.

When using the "name" of the element, often you have to mention all the tree elements and their names.