31 users online (0 members and 31 guests)  

Thread: Drop Down Menus


  Results 1 to 7 of 7

Related

  1. help with two drop down menus    Forum: Javascript Forum
    Replies: 3
  2. two drop down menus    Forum: Website Scripts Forum
    Replies: 10
  3. Drop Down Menus    Forum: HTML Forum
    Replies: 1
  4. Drop down menus    Forum: HTML Forum
    Replies: 0
  5. drop down menus    Forum: HTML Forum
    Replies: 2
  1. #1
    thekents's Avatar
    New User

    Status
    Offline
    Join Date
    Jul 2002
    Location
    NY
    Posts
    7

    Drop Down Menus

    Hi,
    Is there a way to have the Drop Down Menu open a NEW window for the choice?

    Thanks,
    Ed....

  2. #2
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    Hello there.

    We can integrate the popup menu generator code with the drop down menu maker with a little JavaScript Knowledge.

    First, choose what type of window you want to open using the popup window generator. This will give you a chunk of code to put in the head of your document. Copy this in. Here is an example -

    Code:
    <SCRIPT LANGUAGE="JavaScript">
    <!-- Thanks to Nic Wolfe  http://fineline.xs.mw -->
    
    <!-- Begin
    function popup(URL) {
    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=500,height=400,left = 150,top = 100');");
    }
    // End -->
    </script>
    Then all we have to do is change this -

    Code:
    onClick="location=document.jump.menu.options[document.jump.menu.selectedIndex].value;"
    to this -
    Code:
    onClick="popup(document.jump.menu.options[document.jump.menu.selectedIndex].value);"
    The first part is a function.You pass information to a function ( URL ) and it does something with it, in our case opening a window. So instead of our code changing the window location to the selected option, we are passing that info to the function, which then opens the window.

    Hope that helps.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  3. #3
    thekents's Avatar
    New User

    Status
    Offline
    Join Date
    Jul 2002
    Location
    NY
    Posts
    7
    Dean,

    How would it look if I use a graphic rather then the "GO" button?
    Ed....

  4. #4
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    Change the 'function' section of the code given to you by the drop down menu maker to look like this and it will work fine -

    Code:
    <script>
    function jumpMenu(){
    badger=document.jump.menu.options[document.jump.menu.selectedIndex].value;
    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open(badger, '" + id + "', 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=300,height=300,left = 250,top = 150');");
    }
    </script>
    You will not need the other function with this.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  5. #5
    thekents's Avatar
    New User

    Status
    Offline
    Join Date
    Jul 2002
    Location
    NY
    Posts
    7
    Thanks, I'll give it a try. What does the expression "badger" mean?

  6. #6
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    lol.

    That part of the function is defining a variable. The name of the variable can be anything, most people would call it newwindow or popup or something, but it can be anything you feel like.Once the name is set you use that name to access the variable later on. If I cannot be bothered thinking of something, it always gets called badger

    so its not an important javascript word or anything
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  7. #7
    thekents's Avatar
    New User

    Status
    Offline
    Join Date
    Jul 2002
    Location
    NY
    Posts
    7
    As you can tell, I hadn't read over the entire script.



Tags for this Thread