1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

<select>list used as menu

Discussion in 'Web Design & Development' started by MrPopular, Jan 16, 2006.

Thread Status:
Not open for further replies.
Advertisement
  1. MrPopular

    MrPopular Thread Starter

    Joined:
    Apr 10, 2005
    Messages:
    7
    I want to use a <select> list to be a drop down menu. but i don't want to have a submit button, i want to just click on the option in the list and instantly be given the page i want in the next frame. and change the frame the menu it's in. i know how to do all the things apart from making the <select> list work in the first place.
     
  2. Sequal7

    Sequal7

    Joined:
    Apr 14, 2001
    Messages:
    2,382
    Place this in your <head> tag
    Code:
    <SCRIPT LANGUAGE="JavaScript">
    <!-- // DDMenu function
    
    function load1(form) {
         var url = form.Llist_1.options[form.Llist_1.selectedIndex].value;
         if (url != '') location.href = url;
         return false;
    }
    // -->
    </SCRIPT>
    Then your dropdown should look like this:
    Code:
    <form name="DDmenu">
                  <font size="3">Place your text here</font> 
                  <select name="Llist_1" onChange="load1(this.form)">
                    <option value="" selected>Selected Text
                    <option value="link1.htm">Link 1 Text
                    <option value="link2.htm">Link 2 Text
                    <option value="link3.htm">Link 3 Text
                  </select>
                </form>
     
  3. MrPopular

    MrPopular Thread Starter

    Joined:
    Apr 10, 2005
    Messages:
    7
    This makes it come up in the same frame, therefore losing the menu, how do i make it change the frame next to it?

    also, if i do it this way, can i still make it take effect on two frames at once? I know how to do that with ordinary links, but how can i do it this way?
     
  4. Willy Duitt

    Willy Duitt Banned

    Joined:
    Oct 17, 2003
    Messages:
    119
    Try using the target attribute...

    Code:
    <form name="DDmenu" [b]target="[color=red]FRAMENAME[/color]"[/b]>
    

    .....Willy

    BTW: Let me make a few changes to the code which was provided in order to make the target attribute work properly in this context...

    Code:
    <form name="DDmenu" [color=red]action="this.Llist_1.value" target="FRAMENAME"[/color]>
                  <font size="3">Place your text here</font> 
                  <select name="Llist_1" [color=red]onchange="if(this.selectedIndex.value>0)this.form.submit()"[/color]>
                    <option value="" selected>Selected Text
                    <option value="link1.htm">Link 1 Text
                    <option value="link2.htm">Link 2 Text
                    <option value="link3.htm">Link 3 Text
                  </select>
                </form>
    
    Untested but should work...
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/434739

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice