Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > New Popup Window from an existing Popup Window

Reply
Thread Tools

New Popup Window from an existing Popup Window

 
 
Raffi
Guest
Posts: n/a
 
      08-11-2004
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
 
Reply With Quote
 
 
 
 
lallous
Guest
Posts: n/a
 
      08-11-2004
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" <> wrote in message
news: 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



 
Reply With Quote
 
 
 
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      08-11-2004
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
 
Reply With Quote
 
Raffi
Guest
Posts: n/a
 
      08-12-2004
Thomas 'PointedEars' Lahn <> wrote in message news:<>...
> 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
 
Reply With Quote
 
Dr John Stockton
Guest
Posts: n/a
 
      08-12-2004
JRS: In article <>, dated Wed, 11 Aug
2004 19:31:02, seen in news:comp.lang.javascript, Thomas 'PointedEars'
Lahn <> 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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Existing Dll - using Functions from an existing dll Tristin.Colby@gmail.com Ruby 0 02-05-2008 07:38 PM
Why no existing Java type to existing XML schema binding support? nrm Java 3 04-10-2006 04:52 PM
Resize an existing popup window Nigel Molesworth Javascript 0 06-24-2005 02:06 PM
Main > Popup > Popup > Close popup AND new URL in main? Jens Peter Hansen Javascript 7 06-19-2004 08:56 PM
Using window open to change existing window's location Bernd Liebermann Javascript 3 02-11-2004 01:10 PM



Advertisments