Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Jun 2005
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Jump to url from dropdown list selection

    Hi guys, I wonder can you help, I am creating a dropdown menu for my site because I have run out of space for a nav bar, what I would love to do is create a dropdown list that when an option is selected will jump to a specific URL.

    Can you help please?

    thanks,

    Dave.
    Last edited by david_uk; 01-11-2007 at 02:05 PM.

  • #2
    Regular Coder
    Join Date
    May 2006
    Posts
    181
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Try this:
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>Jump to url from dropdown list selection</title>
        <script type="text/javascript"> 
        function jump(obj){ 
            if(obj.selectedIndex != 0){ 
                window.location=obj.options[obj.selectedIndex].value;
            }else{
                alert('Please Select!!!');
            }
        } 
        </script> 
    </head>
    <body>
        <form name="form1"> 
            <select name="jumpMenu" onchange="jump(this.form.jumpMenu)"> 
                <option selected value=""> Please Select </option> 
                <option value="http://google.com/"> Google </option> 
                <option value="http://altavista.com/"> AltaVista </option> 
                <option value="http://yahoo.com/"> Yahoo </option> 
            </select> 
        </form> 
    </body>
    </html>

  • #3
    New Coder
    Join Date
    Jun 2005
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hey Thanks Martial, worked great....

    Dave.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •