Solved

drop down select menu to load link

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
This video teaches users how to migrate an existing Wordpress website to a new domain.
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.

914 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now