+ Reply to Thread
Results 1 to 8 of 8

Thread: Drop-Down Menu.

  1. #1
    Paradox is offline Newbie
    Join Date
    Jul 2008
    Posts
    17
    Rep Power
    16

    Drop-Down Menu.

    This is a basic drop-down menu you can add to your site. It's like a collapse able
    box like in vBulletin Modules. Except the way to get the content to drop is if you click the text & your content will fall underneath the text you clicked.

    Script:
    Code:
    <html>
    <
    head>
    <
    script type="text/javascript">
    function 
    drop(id) {
       if (
    document.getElementById(id).style.display == 'block') {
             
    document.getElementById(id).style.display 'none';
       } else {
                  
    document.getElementById(id).style.display 'block';
       }
    }
    </script>
    </head>
    <body>
    <a onclick="drop(1)">TEXT TO CLICK</a>
    <div id="1" style="display:none;">CONTENT IN THE DROP-DOWN MENU</div>
    </body>
    </html> 
    Last edited by James.H; 03-26-2010 at 03:34 PM.

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Jordan Guest

    Re: Drop-Down Menu.

    We use a technique similar to this on with the blogger that John and I added. I also use the "hide" tags in ionFiles to show/hid more info.

  4. #3
    Join Date
    Mar 2008
    Posts
    7,145
    Rep Power
    86

    Re: Drop-Down Menu.

    Very interesting and easily expandable into multi-level menus

  5. #4
    Join Date
    Aug 2006
    Posts
    11,209
    Blog Entries
    6
    Rep Power
    101

    Re: Drop-Down Menu.

    Good tutorial. +rep given.

  6. #5
    Whitey's Avatar
    Whitey is offline Programming Professional
    Join Date
    Feb 2008
    Location
    Loveland, Colorado
    Posts
    254
    Rep Power
    18

    Re: Drop-Down Menu.

    Now if you did OnMouseOut and OnMouseOver using this it just push's the other text down.. So is there a way to use this for a drop down menu?

  7. #6
    Join Date
    Aug 2009
    Location
    ~/
    Posts
    918
    Rep Power
    19

    Re: Drop-Down Menu.

    simple and clean
    +rep

  8. #7
    toxifyshadow's Avatar
    toxifyshadow is offline Programmer
    Join Date
    Mar 2010
    Location
    Oregon
    Posts
    125
    Blog Entries
    5
    Rep Power
    0

    Re: Drop-Down Menu.

    Sorry if this is off-topic, is there a way to make a drop down menu with links as options?

  9. #8
    NastyDevil's Avatar
    NastyDevil is offline Learning Programmer
    Join Date
    May 2010
    Posts
    90
    Blog Entries
    4
    Rep Power
    7

    Re: Drop-Down Menu.

    Quote Originally Posted by Whitey View Post
    Now if you did OnMouseOut and OnMouseOver using this it just push's the other text down.. So is there a way to use this for a drop down menu?
    Yeah you can simply change the position of the content to absolute so it goes over the text
    Quote Originally Posted by toxifyshadow View Post
    Sorry if this is off-topic, is there a way to make a drop down menu with links as options?
    Yes, all you do is add a <a href="http://forum.codecall.net/javascript/..."> Link </a> to any link you want to make.

    I slightly modified the code to show the two concepts asked about above. And you can make this menu very complex if you want to, just need some simple coding

    Code:
    <html>
    <head>
    <script type="text/javascript">
    function drop(id) {
       if (document.getElementById(id).style.display == 'block') {
             document.getElementById(id).style.display = 'none';
       } else {
                  document.getElementById(id).style.display = 'block';
       }
    }
    </script>
    </head>
    <body>
    <a onclick="drop(1)">TEXT TO CLICK</a> <br />
    <div id="1" style="display:none;position:absolute">
    
    CONTENT IN THE DROP-DOWN MENU <br />
    <a href="http://www.codecall.net">Link 1 </a><br />
    <a href="http://www.codecall.net">Link 2 </a><br />
    
    </div>
    <p>Hello Everyone</p>
    </body>
    </html>

    My modifications are in bold. Oh and sorry if im not allowed to modify the code posted by the original author or anything like that...

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. CSS drop-line menu
    By toldigabor in forum JavaScript and CSS
    Replies: 7
    Last Post: 07-01-2010, 10:25 PM
  2. Drop down menu MYSQL
    By bajerocks in forum PHP Development
    Replies: 1
    Last Post: 04-28-2010, 12:11 AM
  3. grabing value from drop down menu
    By pioneer27 in forum PHP Development
    Replies: 1
    Last Post: 04-21-2009, 03:03 AM
  4. CodeCall Drop Down Menu
    By Whitey in forum JavaScript and CSS
    Replies: 4
    Last Post: 06-17-2008, 01:44 PM
  5. how drop down value will display over the drop down menu
    By anniefs in forum JavaScript and CSS
    Replies: 1
    Last Post: 10-15-2007, 01:09 PM

Tags for this Thread

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