How to Create a popup menu

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • dennishancy@eaton.com

    How to Create a popup menu

    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

  • McKirahan

    #2
    Re: How to Create a popup menu

    <dennishancy@ea ton.com> wrote in message
    news:1106927773 .735994.309520@ z14g2000cwz.goo glegroups.com.. .[color=blue]
    > 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
    >[/color]

    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.opti ons[form.links.sele ctedIndex].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.goog le.com">Google
    <option value="www.yaho o.com">Yahoo
    </select>
    </form>
    </body>
    </html>



    Comment

    • Richard

      #3
      Re: How to Create a popup menu

      On 28 Jan 2005 07:56:13 -0800 dennishancy@eat on.com wrote:
      [color=blue]
      > On my web site, I have a "Links" link.[/color]
      [color=blue]
      > 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).[/color]
      [color=blue]
      > 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.[/color]
      [color=blue]
      > Is there a way to do this within Javascript?[/color]


      Try this little script

      var kid = "FirstOn"
      function ShowInfo(DivId)
      {
      document.getEle mentById(kid).s tyle.display = 'none';
      document.getEle mentById(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="ShowIn fo('item1')"

      Basically works the same way as an image swap.

      As an example see my site.



      Comment

      Working...