Solved

drop down select menu to load link

Posted on 2010-09-14
5
267 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
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 51

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 51

Accepted Solution

by:
HainKurt earned 250 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Because your company can’t afford for you to make SEO mistakes, you’ll want to ensure you’re taking the right steps each and every time you post a new piece of content. This list of optimization do’s and don’ts can help you become an SEO wizard.
Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

770 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