Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-20-2005, 08:03 PM   PM User | #1
tinku
New Coder

 
Join Date: Dec 2004
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
tinku is an unknown quantity at this point
Exclamation Help with script please

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
tinku is offline   Reply With Quote
Old 01-20-2005, 08:13 PM   PM User | #2
Bobo
Regular Coder

 
Join Date: Jan 2004
Location: Port Huron, MI, U.S.A.
Posts: 280
Thanks: 0
Thanked 0 Times in 0 Posts
Bobo is an unknown quantity at this point
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
__________________
Oh, was I supposed to put something here? ........
Bobo is offline   Reply With Quote
Old 01-20-2005, 08:26 PM   PM User | #3
tinku
New Coder

 
Join Date: Dec 2004
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
tinku is an unknown quantity at this point
Hi BOBO,
I changed = to == but still it did not solve the purpose..
Please help...
tinku is offline   Reply With Quote
Old 01-20-2005, 08:33 PM   PM User | #4
Bobo
Regular Coder

 
Join Date: Jan 2004
Location: Port Huron, MI, U.S.A.
Posts: 280
Thanks: 0
Thanked 0 Times in 0 Posts
Bobo is an unknown quantity at this point
Try changing "location" to a different name because it is already used for window.location and could be confusing the browser.
__________________
Oh, was I supposed to put something here? ........
Bobo is offline   Reply With Quote
Old 01-20-2005, 08:48 PM   PM User | #5
tinku
New Coder

 
Join Date: Dec 2004
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
tinku is an unknown quantity at this point
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.
tinku is offline   Reply With Quote
Old 01-20-2005, 10:19 PM   PM User | #6
Basscyst
Smokes a Lot


 
Join Date: Jul 2003
Location: CA, USA
Posts: 1,594
Thanks: 5
Thanked 20 Times in 20 Posts
Basscyst is on a distinguished road
Try using square bracket notation:

something like this I think:

Code:
function ChgCustForm()
{
	if (window.document.main_form.elements['location'].value=='X')
	{
		window.document.main_form.customform.value='CustformX';
	}
}
Basscyst
__________________
Helping to build a bigger box. - Adam Matthews
Basscyst is offline   Reply With Quote
Old 01-24-2005, 04:26 PM   PM User | #7
tinku
New Coder

 
Join Date: Dec 2004
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
tinku is an unknown quantity at this point
Please Guide this script please

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';
}
}
tinku is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:22 AM.


Advertisement
Log in to turn off these ads.