Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    Dec 2004
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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

  • #2
    Regular Coder
    Join Date
    Jan 2004
    Location
    Port Huron, MI, U.S.A.
    Posts
    280
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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? ........

  • #3
    New Coder
    Join Date
    Dec 2004
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi BOBO,
    I changed = to == but still it did not solve the purpose..
    Please help...

  • #4
    Regular Coder
    Join Date
    Jan 2004
    Location
    Port Huron, MI, U.S.A.
    Posts
    280
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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? ........

  • #5
    New Coder
    Join Date
    Dec 2004
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #6
    Smokes a Lot
    Join Date
    Jul 2003
    Location
    CA, USA
    Posts
    1,594
    Thanks
    5
    Thanked 20 Times in 20 Posts
    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

  • #7
    New Coder
    Join Date
    Dec 2004
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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';
    }
    }


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •