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 5 of 5
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Location
    Adirondacks
    Posts
    516
    Thanks
    4
    Thanked 4 Times in 4 Posts

    missing a ( or { or ;

    here's 6 lines of code
    Code:
     
      var x=document.getElementById("whatever")
      alert(x.options[x.selectedIndex].text)
      var teamgrab= x.options[x.selectedIndex].text;
      googleurl= googleurl + teamgrab.value;
       alert(googleurl);
    first line grabs the form info fine
    next line alerts me with the proper value
    The 3rd line gives me an "undefined" value when I use alert to check it's value.

    I've tried what I think is every combination of parenthesis and brackets and.....grrr I can't figure out where my mistake is.

    Could someone please rewrite line 3 correctly

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    Try changing this line

    googleurl= googleurl + teamgrab.value;


    to


    googleurl= googleurl + teamgrab;

    are you wanting the text or the value of the selected option?
    The silent one.

    The most dangerous thing in the world is an idea.
    The most dangerous person in the world is the one with an idea.

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Location
    Adirondacks
    Posts
    516
    Thanks
    4
    Thanked 4 Times in 4 Posts
    text
    IE this
    Code:
    <option value="something">THIS</option>
    ETA thanks for the suggestion but that didn't work
    thanks anyway though I appreciate the reply
    Last edited by FJbrian; 07-04-2007 at 01:57 PM.

  • #4
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    Then you want

    googleurl= googleurl + teamgrab;
    The silent one.

    The most dangerous thing in the world is an idea.
    The most dangerous person in the world is the one with an idea.

  • #5
    Regular Coder
    Join Date
    Jun 2002
    Location
    Adirondacks
    Posts
    516
    Thanks
    4
    Thanked 4 Times in 4 Posts
    That did work
    I can't read
    Thank you!!!


  •  

    Posting Permissions

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