How to Create a popup menu

Discussion in 'Javascript' started by dennishancy@eaton.com, Jan 28, 2005.

  1. Guest

    On my web site, I have a "Links" link.

    Rather than create a separate HTML file listing all the links, I'd like
    to create a popup menu (not sure if that's the official name or not).

    So, when I click on "Links", I'd like to have a small popup menu appear
    with a list of all my links, from which the user can select one.

    Is there a way to do this within Javascript?
    Dennis Hancy
    Eaton Corporation
    Cleveland, OH
     
    , Jan 28, 2005
    #1
    1. Advertising

  2. McKirahan Guest

    <> wrote in message
    news:...
    > On my web site, I have a "Links" link.
    >
    > Rather than create a separate HTML file listing all the links, I'd like
    > to create a popup menu (not sure if that's the official name or not).
    >
    > So, when I click on "Links", I'd like to have a small popup menu appear
    > with a list of all my links, from which the user can select one.
    >
    > Is there a way to do this within Javascript?
    > Dennis Hancy
    > Eaton Corporation
    > Cleveland, OH
    >


    You might consider a drop-down list; for example:

    <html>
    <head>
    <title>linkpick.htm</title>
    <script type="text/javascript">
    function link() {
    var form = document.form1;
    var site = form.links.options[form.links.selectedIndex].value;
    if (site == "") return;
    location.href = "http://" + site;
    }
    </script>
    </head>
    <body>
    <form name="form1">
    <b>Pick a link:</b><br>
    <select name="links" onchange="link()">
    <option value="" selected>
    <option value="www.google.com">Google
    <option value="www.yahoo.com">Yahoo
    </select>
    </form>
    </body>
    </html>
     
    McKirahan, Jan 28, 2005
    #2
    1. Advertising

  3. Richard Guest

    On 28 Jan 2005 07:56:13 -0800 wrote:

    > On my web site, I have a "Links" link.


    > Rather than create a separate HTML file listing all the links, I'd like
    > to create a popup menu (not sure if that's the official name or not).


    > So, when I click on "Links", I'd like to have a small popup menu appear
    > with a list of all my links, from which the user can select one.


    > Is there a way to do this within Javascript?



    Try this little script

    var kid = "FirstOn"
    function ShowInfo(DivId)
    {
    document.getElementById(kid).style.display = 'none';
    document.getElementById(DivId).style.display = 'block';
    kid = DivId;
    }

    "FirstOn" is your opening division.
    <div id="FirstOn" style="display:block;">Text</div>

    Further items can be opened as needed with
    <div id="item1" style="display:none;">links links links what ever</div>

    Then when you want to show it, onclick="ShowInfo('item1')"

    Basically works the same way as an image swap.

    As an example see my site.
    www.somestuff.batcave.net/menu1.html
     
    Richard, Jan 28, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ignasi Giró

    Howto create a popup menu with icons?

    Ignasi Giró, Aug 29, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    703
    Ignasi Giró
    Aug 30, 2005
  2. Steve Richter

    using asp:menu to create drop down menu

    Steve Richter, Jun 5, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    3,299
    Steve Richter
    Jun 5, 2007
  3. Perry Loh
    Replies:
    0
    Views:
    307
    Perry Loh
    Mar 24, 2006
  4. Lorenzo Thurman

    Newbie: How to create a mouse over popup menu

    Lorenzo Thurman, Apr 5, 2004, in forum: Javascript
    Replies:
    4
    Views:
    117
    William Morris
    Apr 6, 2004
  5. Jens Peter Hansen
    Replies:
    7
    Views:
    548
    Randy Webb
    Jun 19, 2004
Loading...

Share This Page