Help - Search - Members - Calendar
Full Version: Drop Down Menus - No New Window
HTMLHelp Forums > Web Authoring > Web Site Functionality
Steve Guerin
Hi everyone - been reading the forum for some time and have learned so much.

I have a question about drop down menus I am trying to implement on a new hockey website. Basically, I am using the html below. Everything is fine, except with this code, every time an item is selected, it opens in a new window.

How can I alter this code so that selections DO NOT open a new window, and instead just direct readers straight to the desired link?

<select name="menu" onchange="window.open(this.options[this.selectedIndex].value,'_blank')"><option> Basic Stats</option><option value="http://wildwood365.blogspot.com">Games</option><option value="http://wildwood365.blogspot.com">Goals</option><option value="http://wildwood365.blogspot.com">Assists</option><option value="http://wildwood365.blogspot.com">Points</option></select>
Darin McGrew
Please see the FAQ entry How can I use forms for pull-down navigation menus?
pandy
Well, that's what window.open() does. It opens a new window. The "_blank" you have there doesn't help either, but I think in this case it simply does nothing.

Try redirecting the current window instead. Try something like this.
CODE
onchange="window.location.href=this.options[this.selectedIndex].value;"
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.