...

View Full Version : Help with script please



tinku
01-20-2005, 09:03 PM
Hi
Thank you in advance for any help
Here's what I am trying to do...
I have two drop down lists location and custom form depending on location the custom form value changes.

function ChgCustForm()
{
if (window.document.main_form.location.value='X')
{
window.document.main_form.customform.value='CustformX';
}
}

no error but does slove the purpose either please help

Bobo
01-20-2005, 09:13 PM
function ChgCustForm()
{
if (window.document.main_form.location.value=='X')
{
window.document.main_form.customform.value='CustformX';
}
}

it will always be true otherwise because using = instead of == acts as an operator that sets values

tinku
01-20-2005, 09:26 PM
Hi BOBO,
I changed = to == but still it did not solve the purpose..
Please help...

Bobo
01-20-2005, 09:33 PM
Try changing "location" to a different name because it is already used for window.location and could be confusing the browser.

tinku
01-20-2005, 09:48 PM
Cant change the name since I have no access to the source code ..
location is what I have to use ...
Is there anything else u can think of ..
Thanks for all the replies.

Basscyst
01-20-2005, 11:19 PM
Try using square bracket notation:

something like this I think:



function ChgCustForm()
{
if (window.document.main_form.elements['location'].value=='X')
{
window.document.main_form.customform.value='CustformX';
}
}


Basscyst

tinku
01-24-2005, 05:26 PM
Doesn't work either. can somebody please guide on this script please.
function ChgCustForm()
{
if (window.document.main_form.elements['location'].value=='X')
{
window.document.main_form.customform.value='CustformX';
}
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum