TECH Drop Down Menu

nucklearknight

New Member
Sep 21, 2008
365
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>
 

hurleyint1386

Someone has sand in their vagina
Jan 6, 2005
3,646
Rochester, NY
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>

There are ways of doing it with CSS. But Javascript is another way of doing it (probably the easiest).
 

kingtoad

Well-Known Member
Sep 2, 2003
55,788
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.
 
TS
TS

nucklearknight

New Member
Sep 21, 2008
365
San Francisco, California
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.
Ok thanks. I'll look into it with javascript then.
 

Users who are viewing this thread

About Us

  • Please do not post anything that violates any Local, State, Federal or International Laws. Your privacy is protected. You have the right to be forgotten. Site funded by advertising, link monetization and member support.
OT v15.8.1 Copyright © 2000-2022 Offtopic.com
Served by fu.offtopic.com

Online statistics

Members online
144
Guests online
43
Total visitors
187

Forum statistics

Threads
369,680
Messages
16,907,607
Members
86,875
Latest member
DSimnovec