Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
ok, i got a popup script, listed below
function profile_window(wname)
{
newWindow=window.open('','test','menubar=no,location=no,resizable=no,scrollbars=yes,status=no,width=557,height=389');
newWindow.location=wname;
}now, ive got the above code 4 times, but with different hight and width for use with 4 different pages on my site.. works great, 1 problem tho...
if someone has clicked and launched a popup, if they launch another 1 while that popup is still open, the new page will load in the existing popup.... bad!
so, just as a test, tried another popup code
function enterchat_window(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=784,height=500,left = 484.5,top = 356.5');");
}now... when that is called, it opens in a new window than the other popup code 1, but, again, if u call another popup usin the same code, it just loads in the popup thats already 'poped up'
am i missing somethin?

Uh, yeah. In your first example replace 'test' with the variable wname that is being passed to the function. Then remove the second line "newWindow.location=wname"
Every time you call the function, it is opening a window called 'test'. Of course if that window already exists (which it does after the first time) it just opens the contents in the current instance.
If it were me, I'd also pass the URL to the function as well as the height and width since yousay those vary. Something like this:
function newWindow(wname,url,width,height) {
wname=window.open(url,wname,'menubar=no,location=no,resizable=no,scrollbars=yes,status=no,width='+width+',height='+height);
}
The one problem with this is that if you try to open a new window with the same name as one that already exists, the windows will not be resized - it will just load the new contnet. You could either do a check to see if a window of the same name is open (and close it if it is) or resize the window after opeining the page. But, from what you explained, this should work for you.
Michael J

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |