Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Computer Forums > Programmers Lounge > Programming Discussions » Drop down links need to open new window
Reply
Old 08-27-2009, 11:30 AM   #1 (permalink)
 
Newb Techie

Join Date: Sep 2006

Posts: 27

bukwus is on a distinguished road

Question Drop down links need to open new window

Hi

I'm building a drop down menu and each option link needs to open a new window. Here's the code:

Code:
<form>
<select onChange="if(options[selectedIndex].value) window.location.href=(options[selectedIndex].value)">
<option>Select a Country</option>
<option value="http://www.link.com">Global</option>
etc.
I'm thinking there's extra code I need to add to the onChange, but I'm not sure what that would be. Can anyone help me with this?

Thanks
bukwus is offline   Reply With Quote
Old 08-27-2009, 05:25 PM   #2 (permalink)
CrazeD's Avatar
 
Wizard Techie

Join Date: Feb 2006

Location: Maine

Posts: 3,683

CrazeD will become famous soon enough

Send a message via AIM to CrazeD Send a message via MSN to CrazeD
Default Re: Drop down links need to open new window

Change window.location.href= to window.open

Then it will work.
__________________

Need website help? PM me!
CrazeD is offline   Reply With Quote
Old 09-15-2009, 10:48 AM   #3 (permalink)
 
Newb Techie

Join Date: Sep 2006

Posts: 27

bukwus is on a distinguished road

Default Re: Drop down links need to open new window

That worked perfectly. Thanks.

Quote:
Originally Posted by CrazeD View Post
Change window.location.href= to window.open

Then it will work.

bukwus is offline   Reply With Quote
Old 09-15-2009, 05:19 PM   #4 (permalink)
oldskool's Avatar
 
Electrical Systems Design

Join Date: Jun 2008

Location: Maine, USA

Posts: 1,646

oldskool has a spectacular aura aboutoldskool has a spectacular aura about

Default Re: Drop down links need to open new window

Quote:
Originally Posted by CrazeD View Post
Change window.location.href= to window.open

Then it will work.
and window.location.href wouldn't work there without because it was pointing to an URL that wasn't listed.
oldskool is offline   Reply With Quote
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I "Choose the program you want to open this file"? barbwire111 Windows Operating Systems and Software 2 07-29-2009 01:26 AM
Force Firefox To Open Links In Same Tab Osiris Tips, Tricks & Tutorials 0 07-03-2009 01:24 PM
Resize The Firefox Window With Geometry Osiris Tips, Tricks & Tutorials 0 05-22-2009 08:10 AM
Open source 2D RPG engine searching for interested C++ programmers mvBarracuda Programming Discussions 19 10-11-2007 10:57 AM