469,327 Members | 1,315 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,327 developers. It's quick & easy.

New Popup Window from an existing Popup Window

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
Jul 23 '05 #1
4 1655
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...');

--
Elias
"Raffi" <th*********@yahoo.com> wrote in message
news:fe**************************@posting.google.c om...
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

Jul 23 '05 #2
lallous wrote:
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...');
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.
[Top post]


<http://www.jibbering.com/faq/faq_notes/pots1.html#ps1Post>
PointedEars
Jul 23 '05 #3
Thomas 'PointedEars' Lahn <Po*********@web.de> wrote in message news:<20****************@PointedEars.de>...
lallous wrote:
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...');


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.
[Top post]


<http://www.jibbering.com/faq/faq_notes/pots1.html#ps1Post>
PointedEars


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
Jul 23 '05 #4
JRS: In article <20****************@PointedEars.de>, dated Wed, 11 Aug
2004 19:31:02, seen in news:comp.lang.javascript, Thomas 'PointedEars'
Lahn <Po*********@web.de> posted :
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.

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.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://jibbering.com/faq/> JL / RC : FAQ for news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 23 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Willem van Isselmuden | last post: by
38 posts views Thread by Shaun McKinnon | last post: by
1 post views Thread by Ian Hubling | last post: by
1 post views Thread by MJEASSOC | last post: by
23 posts views Thread by Markus | last post: by
3 posts views Thread by clsmith66 | last post: by
1 post views Thread by anandclt | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by listenups61195 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.