Drop down menus - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Drop down menus

BinkBink Posts: 1Member
I have been looking all over the internet to figure out how to script this, with no luck. Here's what I wanted to do:

There is a table in my web site, and the drop down menu would be in a , with bits of information in the remaining two 's. When people select an option in the drop down menu, two sets of text would immediatly change to match the topic selected. If this made any sense, any help would be greatly appreciated. Thanks!!

-Bink

Comments

  • iDaZeiDaZe Posts: 464Member
    : I have been looking all over the internet to figure out how to script this, with no luck. Here's what I wanted to do:
    :
    : There is a table in my web site, and the drop down menu would be in a , with bits of information in the remaining two 's. When people select an option in the drop down menu, two sets of text would immediatly change to match the topic selected. If this made any sense, any help would be greatly appreciated. Thanks!!
    :
    : -Bink
    :

    Just a ruff idea,
    you could put each piece of text between
    tags and make none-selected parts invisible and the selected parts visible (using style-stuff), something like this:
    (this is just a notational way, and not real javascript, I don't know all the exact syntax, like I said, just a ruff idea)
    [code]
    onDropDownChange(){
    for each option in the dropdown menu do{
    if (option == selected) {
    (OptionID + 'Text1').style.display = '';
    (OptionID + 'Text2').style.display = '';
    } else {
    (OptionID + 'Text1').style.display = 'none';
    (OptionID + 'Text2').style.display = 'none';
    }
    }
    }
    [/code]
    The ID or Name (depending on what you prefer, personally, I use ID's) of the divs should be the ID of the option it belong to with 'text1' pr 'text2' appended to is, something like this:
    (Initially, all text except for that belonging to option 1 will be invisible, since option 1 will be selected from the beginning)
    [code]


    Option
    Another Option




    bla bla ...





    Some other bla bla



    [/code]

    Hope this helps you


Sign In or Register to comment.