?
Solved

drop down select menu to load link

Posted on 2010-09-14
5
Medium Priority
?
273 Views
Last Modified: 2012-05-10
Hello All,

I need to set up a html drop down menu that sends the user to a specific url upon clicking the choice. Any help would be great. I will attach the code below. Thanks.
<select class="fl" style="padding:6px 8px;height:32px;margin-right:10px;">
  <option>Pick a region</option>
  <option>New York</option>
  <option>Philidelphia</option>
  <option>Pittsburg</option>
  <option>Tampa Bay</option>
</select>
<a href="javascript:void(0);" class="button">Ok</a>

Open in new window

0
Comment
Question by:yando18
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 19

Expert Comment

by:erikTsomik
ID: 33676883
you can do something like this
<select onchange="window.open(this.options[this.selectedIndex].value,'_top')" class="fl" style="padding:6px 8px;height:32px;margin-right:10px;">

    <option value=">Pick a region</option>
  <option value="http://newyour.com">New York</option>
  <option value="http://Philidelphia.com">Philidelphia</option>
  <option>Pittsburg</option>
  <option>Tampa Bay</option>
</select>
0
 
LVL 13

Expert Comment

by:darren-w-
ID: 33676902
0
 
LVL 58

Expert Comment

by:HainKurt
ID: 33676979
or something like this
<script>
function openURL(url){
  if (url != "") window.open(url,'_top');
}
</script>

<select onchange="openURL(this.value)" class="fl" style="padding:6px 8px;height:32px;margin-right:10px;">
  <option value="">Pick a region</option>
  <option value="http://newyork.com">New York</option>
  <option value="http://Philidelphia.com">Philidelphia</option>
  <option value="http://Pittsburg.com">Pittsburg</option>
  <option value="http://TampaBay.com">Tampa Bay</option>
</select>

Open in new window

0
 
LVL 58

Accepted Solution

by:
HainKurt earned 1000 total points
ID: 33676994
or this using a button
<script>
function openURL(url){
  if (url != "") window.open(url,'_top');
}
</script>

<select id=selURL class="fl" style="padding:6px 8px;height:32px;margin-right:10px;">
  <option value="">Pick a region</option>
  <option value="http://newyork.com">New York</option>
  <option value="http://Philidelphia.com">Philidelphia</option>
  <option value="http://Pittsburg.com">Pittsburg</option>
  <option value="http://TampaBay.com">Tampa Bay</option>
</select>

<a href="javascript:openURL(selURL.value);" class="button">Ok</a>

Open in new window

0
 

Author Comment

by:yando18
ID: 33678285
Thanks I will give some of these a shot.
0

Featured Post

WordPress Tutorial 3: Plugins, Themes, and Widgets

The three most common changes you will make to your website involve the look (themes), the functionality (plugins), and modular elements (widgets).

In this article we will briefly define each again, and give you directions on how to install them.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
CTAs encourage people to do something specific to show interest in your company, product or service. Keep reading to learn why CTAs should always be thought of as extremely important, albeit small, sections of websites.
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question