Solved

drop down select menu to load link

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

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Mouse event to control image and transparency. 4 34
VBScript on Html 15 47
Returning a value from a class function to a partial view in MVC5 7 28
Designing forms 3 17
Learn by example how to specify CSS selectors for Selenium WebDriver test automation software.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

860 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