www.webdeveloper.com
Results 1 to 3 of 3

Thread: Select a type then display corresponding select-menu?

Hybrid View

  1. #1
    Join Date
    Apr 2011
    Location
    New Home Team - Everett, WA
    Posts
    261

    Exclamation Select a type then display corresponding select-menu?

    I have 3 "options" and each option has a list of sub-options... like "Choose by Make", "Choose by Model", and "Choose by Year" so then you would get:

    By Make:
    • Ford
    • Toyota
    • Mazda
    • Honda
    • Etc

    By Model:
    • Ford F150
    • Ford F250
    • Ford F350
    • Ford Focus
    • Toyota Prius
    • Toyota Corolla
    • etc

    By Year:
    • 2012
    • 2011
    • 2010
    • 2009
    • 2008
    • etc


    So I need them to be able to select whcih menu they want to choose from, because I don't want them to be able to choose more than one of those menus... Also, teh menu they choose will have a "hidden" input value of the menu's type, so like input type="hidden" name="listtype" value="year" or something.

    So I need the menus they didn't choose to be hidden.

    Any help is greatly appreciated. Thanks!

  2. #2
    Join Date
    Nov 2010
    Posts
    978
    you mean like this...?

    Code:
    <!DOCTYPE html>
    <html>
    <head>
    <style>
    .hide{
    display:none;
    }
    </style>
    </head>
    
    <body> 
    <select onchange="chooseSel(this)">
    <option> - please select - </option>
    <option value="make">Make</option>
    <option value="model">Model</option>
    <option value="year">Year</option>
    </select>
    
    <select class="hide" id="make">
    <option> - please select a make - </option>
    </select>
    
    <select class="hide" id="model">
    <option> - please select a model - </option>
    </select>
    
    <select class="hide" id="year">
    <option> - please select a year - </option>
    </select>
    
    <script type="text/javascript">
    function chooseSel(sel){
    sel.style.display="none"
    document.getElementById(sel.value).style.display="block"
    }
    </script>
     </body>
     </html>

  3. #3
    Join Date
    Apr 2011
    Location
    New Home Team - Everett, WA
    Posts
    261
    Yes, that should do it. Thanks.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles