To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.off-topic.geekOpen lugnet.off-topic.geek in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Off-Topic / Geek / 5201
5200  |  5202
Subject: 
Re: need (JavaScript) help, please!
Newsgroups: 
lugnet.off-topic.geek
Date: 
Sun, 4 May 2008 23:25:09 GMT
Viewed: 
8158 times
  
In lugnet.off-topic.geek, Franklin W. Cain wrote:
document.location.href = 'http://' + SERVER +
'.gamesite.com/playerstats.html?target=' + PLAYERNAME

What you're doing there is setting the current document's URL to some value-- in
this case some URL that looks like:

http://SERVER.gamesite.com/playerstats.html?target=PLAYERNAME

So that will open the new URL just fine, it'll just take the place of your
current document.  What you want is to open a new window, or a new tab, which
would be something like this:

myWin=open("http://"+SERVER+".gamesite.com/playerstats.html?target="+PLAYERNAME,"newwin1","width=640,height=350,status=no,toolbar=yes,scrollbars=yes,resizable=yes,menubar=yes");

That'll open the new window with the specified URL. It's important to note,
however, that the name of this window is (in this case) "newwin1". So if you
tried to open ANOTHER window with the same name, it actually won't do it!
Instead, it will overwrite the contents of "newwin1" with whatever URL you open
the second time. So, (assuming you don't want to do this), you'll need to use a
different name the next time (so maybe make it a variable, or wrap the statement
in an eval and name the window something else). There's probably a way to make
it open a generic unnamed window, too, but I'm not sure how without going and
looking it up, so I'll just leave it at that for now!

I haven't really played around with opening a new tab versus a new window
myself, but I know you can do that too (somehow!). Again, something I'd have to
go and look up! Anyway, HTH!

DaveE



Message is in Reply To:
  need (JavaScript) help, please!
 
I'm trying to code a script, for inclusion into a webpage (HTML), that will enable me to spontaneously create a link to be opened as a new page. The format of the URL is as follows: (URL) two variables are the specific game server and the specific (...) (16 years ago, 4-May-08, to lugnet.off-topic.geek)

2 Messages in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR