Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Dropdown Menu

Featured Replies

Hi,

I have a menu that lets me select from multiple options, and I want that any option that I choose will lead me to another website, after that I click the submit button.

How I do this?

 

<form action="" method="post">

<select name="Dropdown Menu" id="menu">
<option selected>Select</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>

<input type="submit" value="" id="button">
</form>

 

Thanks,

Steve

I think you're using the wrong method. A form isn't meant to be used as a menu. A form needs an "action" to send an email or send data to a database.

 

Try a pure CSS drop down menu from cssplay

http://www.cssplay.co.uk/menus/

 

This is a basic drop down menu http://www.cssplay.co.uk/menus/basic_dd.html

You copy/paste from the head section styles and from the html body markup and edit to suit your page styles and insert your own link urls.

 

Most cssplay menus have several top level tabs but you only need one (with one drop down level) so you can delete quite a lot of the html markup from a cssplay example.

  • Author

Thank you so much.

 

I created the menu, but now I have a problem with the design.

 

I set an image as the background of the menu, but the text does not appear in the middle (it appears in the center but in the top, since the height is bigger than the font size).

Here is a screenshot:

http://www.mypicx.com/11162010/screenshot/

 

Here is the code in the Stylesheet:

 

}
#menu {
padding: 0px 0px 0px 0px;
margin: 140px 0px 0px 93px;
width: 222px; height: 34px;
text-align: center;
font: 14px Ariel;
background: no-repeat url(images/type.jpg);
border: 0px;

 

 

Here is the code in the Header:

 

<form name="jump">
<select name="menu" id="menu">
<option selected>Select an option</option>
<option value="http://www.site1.com/">option1</option>
<option value="http://www.site2.com/">option2</option>
<option value="http://www.site3.com/">option3</option>
<option value="http://www.site4.com/">option4</option>
</select>
<input type="button" onClick="location=document.jump.menu.options[document.jump.menu.selectedIndex].value;" value="" id="button">
</form>

 

Thanks

Steve

I tried your form but the links didn't work.

 

I found a javascript select box method for links here where the links do work:-

http://www.javascripter.net/faq/linksina.htm

and used it for your menu like this:-

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html  xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html;  charset=utf-8" />
<style type="text/css">

#menu {
padding: 8px 0px 0px 0px;
margin: 0px 0px 0px 0px;
width: 222px; height: 34px;
text-align: center;
font: 14px Arial;
background: lime no-repeat url(images/type.jpg);
border: 0px; }

select { background: skyblue; text-align: center; }

</style>

</head>

<body>

<form name="jump">
<select name="menu" id="menu"
onChange="if(this.selectedIndex!=0)
self.location=this.options[this.selectedIndex].value">
<option selected>Select an option</option>
<option value="http://www.google.com/">option1</option>
<option value="http://www.webdesignerforum.co.uk/">option2</option>
<option value="http://www.bbc.co.uk/">option3</option>
<option value="http://www.supanet.com/">option4</option>
</select>
</form> 

</body>
</html>

The select boxes are colored skyblue because I don't have your background image. IE7 doesn't process the text-align: center but Firefox does.

 

I hope that helps a bit.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.