November 15, 201016 yr 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
November 15, 201016 yr 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.
November 16, 201016 yr 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
November 16, 201016 yr 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.
November 16, 201016 yr Author I have used this site to create the menu and the submit button: http://javascript.internet.com/generators/drop-down-menu.html (I chose the option "Use button") My question is how do I center the text so that the text will be in the center of the box and not as it is now: http://www.mypicx.com/11162010/screenshot/ Thank you, Steve
Create an account or sign in to comment