...

View Full Version : Change Form Action



christrinder
07-02-2003, 09:31 AM
Hello,

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...

id="formtags"

Any help would be much appreciated.
Thanks,
Chris

- - - - - - - - - -

function ChangeFormAction()
{
var srcElem = window.event.srcElement;
var action = formtags.action;
action="DealerSalesReports.aspx"

if(srcElem.value == 5)
{
action="DealerLeadsSummary.aspx"
}
}

Kor
07-02-2003, 10: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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum