New Popup Window from an existing Popup Window

New Popup Window from an existing Popup Window

Post by thegrizzzl » Thu, 12 Aug 2004 17:20:16


I need to do the following:

From the main page I click a link button and open a javascript popup
window. So far so good. Now when i try to open a new popup window from
a button link in the first popup window, it redirects the existing
popup window to the new URL. I need to have it open a new popup window
(of a different size) to display the new page. How can I do this?

Thanks,

Raffi
 
 
 

New Popup Window from an existing Popup Window

Post by lallou » Thu, 12 Aug 2004 20:32:01

Hello

You need to give a different window name to each popup, do this like:

// global variable
var x = 0;

window.open('theUrl.htm', 'window'+(x++), 'options here...');

 
 
 

New Popup Window from an existing Popup Window

Post by Thomas 'Po » Fri, 13 Aug 2004 02:31:02


Globals are evil[tm] and in most cases not required. Besides, the global
variable is attached to the current window. If I open the popup that
contains the above code with

window.open(..., 'window1', ...')

the above statement of yours will re-use that popup anyway.
A better approach:

window.open('...', 'window' + new Date().getTime(), '...');

Since the return value of Date.prototype.getTime() changes every
millisecond, it is unlikely that an existing window will be reused.
If the return value of that method "jumps" forth/back because of
switching from/to daylight saving time, it is unlikely that a window
will be reused either because that would require thousands of named
windows to be open.


< http://www.yqcomputer.com/ #ps1Post>


PointedEars
 
 
 

New Popup Window from an existing Popup Window

Post by thegrizzzl » Fri, 13 Aug 2004 17:48:49


Thanks for the suggestions. I figured it out. I'm opening the
different windows without using too many globals, other than a couple
of variables for the popup window position.

Raffi
 
 
 

New Popup Window from an existing Popup Window

Post by Dr John St » Fri, 13 Aug 2004 22:21:07

JRS: In article < XXXX@XXXXX.COM >, dated Wed, 11 Aug

Lahn < XXXX@XXXXX.COM > posted :



In the words, perhaps imperfectly quoted, of WSC - "Who is Mr Round, and
what is the basis of his objection?".


The return value of Date.prototype.getTime() is on my system zero; it
does not change.

The time resolution of a javascript date object is indeed a millisecond;
but that is not the same as the resolution of new Date() - the latter
is 10 ms in some systems, and 55 ms in some others. There may well be
systems in which its resolution is 1 ms; but an Internet author can rely
on nothing better than 55 ms (worse may be possible, of course).

The stored value represents C/UNIX time_t in milliseconds - that is
measured from 1970-01-01 00:00:00 GMT (leap seconds are ignored). It is
that stored value which is returned by getTime and valueOf. Summer Time
(Sommerzeit) is utterly irrelevant.

If the value did jump back in autumn, duplication would be
possible if a single window were opened in the hour before the
change, and a second were attempted exactly one hour later, at
the identical civil time. Thousands would not be required.

If you had made full & proper use of the newsgroup FAQ, you would have
understood these things.

--
< http://www.yqcomputer.com/ ;m> jscr maths, dates, sources. < http://www.yqcomputer.com/ >/> TP/BP/Delphi/jscr/&c, FAQ items, links.