Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: Change Form Action
07-02-2003, 10:31 AM #1
- Join Date
- Nov 2002
- Loughborough (UK)
- Thanked 0 Times in 0 Posts
Change Form Action
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.
- - - - - - - - - -
var srcElem = window.event.srcElement;
var action = formtags.action;
if(srcElem.value == 5)
07-02-2003, 11:05 AM #2
- Join Date
- Apr 2003
- Bucharest, ROMANIA
- Thanked 379 Times in 375 Posts
"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.