Welcome to WebmasterWorld Guest from

Forum Moderators: incrediBILL

Message Too Old, No Replies

jumpPage query

How do I open new window in selection box?



9:31 am on Aug 12, 2002 (gmt 0)

10+ Year Member

I am using a jumpPage script (in a selection box)to jump to a new url without clicking on "Go" but it always opens in the same window.

How do I get it to open in a new window?

The script is:
<!-- Hide script from older browsers
function jumpPage(newLoc) {
newPage = newLoc.options[newLoc.selectedIndex].value
if (newPage != "") {
window.location.href = newPage
// End hiding script from older browsers -->

And it is activated in a form as follows :

<form action="gotoLocation.cgi" method="GET" target="_blank">
<select name="newLocation" onChange="jumpPage(this.form.newLocation)" class="smalltext">
<option value="" selected>Option 1 etc

Any assistance much appreciated.


6:29 am on Aug 13, 2002 (gmt 0)

WebmasterWorld Senior Member drdoc is a WebmasterWorld Top Contributor of All Time 10+ Year Member

Change window.location.href to blah.location.href

blah is the name of the window. If a window with that name doesn't exist it will be created. If you need to open a window with certain attributes, use the window.open method.


8:43 am on Aug 13, 2002 (gmt 0)

10+ Year Member

Thanks for the reply DrDoc - I changed the script as suggested ......

But it is not working now - when I click on a new selection nothing happens.

Any thoughts?


3:49 pm on Aug 13, 2002 (gmt 0)

10+ Year Member

Hey Bran,
A tip: when you have problems with JavaScript, try using Netscape or other web browser that can tell you where the error is. It makes debugging JavaScript much easier.

Now, what I would do is change the

window.location.href = newPage
for a
, or something very similar to that :)
That will guarantee a new window.
Hope that helps.


5:38 pm on Aug 13, 2002 (gmt 0)

10+ Year Member

Sorry to be so dumb but I do not know how to use window.open in a drop down box or is it the jumpPage function that I need to amend to window.open?

Really new to this and only 2 strands of hair left!


6:11 pm on Aug 13, 2002 (gmt 0)

10+ Year Member

no problem, here:
In your function jumpPage, change line:
window.location.href = newPage


That's it! :)

Want to learn more JavaScript? I suggest you visit [javascriptsource.com ], they have lots and lots of JavaScripts for many different things, you can use and/or study the code.
Maybe the JavaScript reference guide would be useful too. I can't remember where did I downloaded it from, but if you like it I can send it to you by email, but notice, it is a 6.4 MB PDF file!
Let me know.


8:44 am on Aug 14, 2002 (gmt 0)

10+ Year Member

Many thanks, transistor - that is perfect!

If you could send me the file that would be much appreciated - fortunately I have broadband so the file size should be ok.

Thanks again....


Featured Threads

Hot Threads This Week

Hot Threads This Month