SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Dec 2006
    0 Post(s)
    0 Thread(s)

    Question form drop down menu list help!?!?

    Hi everyone I am stuck on trying to get a form drop down menu list to work.

    I have tried 2 different examples and have encountered problems with both.

    Please look at these 2 drop downs I am trying to get to work:


    The problem with #1 is the when you click on the drop down and you click away the menu stays open. I need the menu to collapse. The only way to get the menu to close is when you select an item.

    The problem with #2 is when you click on the drop down all the options are scrambled and are not organized. I cannot tell what I have selected. I got the code for #2 from this URL:

    Please can someone help me fix one of these or both!?!?


  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Christchurch, New Zealand
    104 Post(s)
    4 Thread(s)
    With the first one, you can have the dropdown box close when you click on the very top line with something like this

    Code Javascript:
    document.getElementById("mySelectText0").onclick = function() { showOptions(0) }

    But as far as closing it when you click anywhere else, you would need to monitor window.onclick, work out if the drop down box is opened or closed, and only if it is open do you call the showOptions(0) function.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


Posting Permissions

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