WEB Drop Down Menu

Discussion in 'OT Technology' started by nucklearknight, Oct 23, 2008.

  1. nucklearknight

    nucklearknight New Member

    Joined:
    Sep 21, 2008
    Messages:
    367
    Likes Received:
    0
    Location:
    San Francisco, California
    I want to have a drop down menu for my website that has a "GO" button next to it so the user can select the link they want and hit the "GO" button and it will take them to that url. Is there a way to do it with HTML only? Or do I need Java? Here's what I have so far:
    Code:
    <html>
    <head>
        <title>Form</title>
    </head>
    
    <h1><center>My Links</center></h1>
    <body>
    
    <form>
    <select>
        <option>Home</option>
        <option>About Me</option>
        <option>Programs</option>
    </select>
    <input type="submit"
     value="GO">
    </form>
    
    </html>
     
  2. hurleyint1386

    hurleyint1386 Someone has sand in their vagina

    Joined:
    Jan 6, 2005
    Messages:
    3,687
    Likes Received:
    0
    Location:
    Rochester, NY
    There are ways of doing it with CSS. But Javascript is another way of doing it (probably the easiest).
     
  3. kingtoad

    kingtoad OT Supporter

    Joined:
    Sep 2, 2003
    Messages:
    55,924
    Likes Received:
    11
    Location:
    Los Angeles
    Code:
    
    <html>
    <head>
        <title>Form</title>
    </head>
    
    <h1><center>My Links</center></h1>
    <body>
    
    <form>
    <select onChange="if(this.selectedIndex!=0) self.location=this.options[this.selectedIndex].value">
        <option value="index.html">Home</option>
        <option value="about.html">About Me</option>
        <option value="programs.html">Programs</option>
    </select>
    <input type="submit"
     value="GO">
    </form>
    
    JavaScript is what's responsible for this. Not exactly the most elegant but it's the solution you asked for.
     
  4. nucklearknight

    nucklearknight New Member

    Joined:
    Sep 21, 2008
    Messages:
    367
    Likes Received:
    0
    Location:
    San Francisco, California
    Ok thanks. I'll look into it with javascript then.
     

Share This Page