Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 6 of 6
  1. #1
    Member
    Join Date
    Mar 2011
    Posts
    34
    Member #
    27208
    Hey, I was having trouble alerting the value of a drop down select menu. I want the user to choose an <option> then click submit here is my html code:
    HTML Code:
             <select id='type'>
                        <option>Option 1</option>
                        <option>Option 2</option>
    
                        <option>Option 3</option>
                        </select>
                        <input type='button' onClick='alertselected(document.getElementById("type"))' value='Addit!'>
    Now here is my javascript function

    Code:
    function alertselected(selectobj){
     alert(selectobj.selectedIndex.value);
    }
    Now when I click the button, nothing happens.

  2.  

  3. #2
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,483
    Member #
    425
    Liked
    2783 times
    You're close:
    Code:
    alert(selectobj.options[selectobj.selectedIndex].value);
    Ben shaughnessy likes this.
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)

  4. #3
    Member
    Join Date
    Mar 2011
    Posts
    34
    Member #
    27208
    Thanks you so much! I spent like 2 days yelling at my computer!

  5. #4
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,483
    Member #
    425
    Liked
    2783 times
    Did it yell back? If so, you gotta Youtube that stuff.
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)

  6. #5
    Member
    Join Date
    Mar 2011
    Posts
    34
    Member #
    27208
    yea it yelled back, I think I tried that originally but I don't know what it was, it worked after you told me. I have javascript.

  7. #6
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,483
    Member #
    425
    Liked
    2783 times
    NICE!

    There's only one thing that anyone can say in response to your computer yelling back at you:

    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 05:21 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com