Results 1 to 6 of 6

Thread: Menu Selection to show a div box

  1. #1
    Join Date
    Jul 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Menu Selection to show a div box

    I'm trying to get my menu to show a div box depending on which option is selected. I had two "hidden" div boxes with text in them, and when i select option 1 i would like that corresponding div to appear, but if i select another i would like to make sure all other divs are hidden and show the correct box. Any ideas?

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    http://www.dynamicdrive.com/dynamici...tchcontent.htm

    For manual reference, to hide a div, you set document.getElementById("divid").style.display to "none." To unhide the div, set it to "block."
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Jul 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I saw that, but the problem is getting an option in a menu (drop-down) to begin the event.

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Not at all; simply change the anchor tag to something like:
    <a href="javascript:void(0);" onclick="doStuff();return false;">Menu Item 1</a>
    Better still, if you have anything better and appropriate to link to, change javascript:void(0); to an URI. This won't affect JavaScript browsers, only non-JS ones.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  5. #5
    Join Date
    Jul 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    ok, new problem. if i select option one, that corresponding div appears, but if i meant to click option two and go back to select it again, now they're both open. what would you do to ensure that when one opens the other is closed/hidden?

  6. #6
    Join Date
    Sep 2005
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by thecraigmcrae
    I'm trying to get my menu to show a div box depending on which option is selected. I had two "hidden" div boxes with text in them, and when i select option 1 i would like that corresponding div to appear, but if i select another i would like to make sure all other divs are hidden and show the correct box. Any ideas?
    I actually made that specific scenario to work.
    If you want I will email you the code I've used.
    It is pretty interesting, it took me awhile. The only thing I am having issues is that the text will apear properly but if I select the text it will select all DIV Items together.
    send me an email to seriy1@gmail.com I will respond with a sample code.

Bookmarks

Posting Permissions

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