New Popup Window from an existing Popup Window

Discussion in 'Javascript' started by Raffi, Aug 11, 2004.

  1. Raffi

    Raffi Guest

    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
    Raffi, Aug 11, 2004
    #1
    1. Advertising

  2. Raffi

    lallous Guest

    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:...
    > 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
    lallous, Aug 11, 2004
    #2
    1. Advertising

  3. 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
    Thomas 'PointedEars' Lahn, Aug 11, 2004
    #3
  4. Raffi

    Raffi Guest

    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
    Raffi, Aug 12, 2004
    #4
  5. 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.
    Dr John Stockton, Aug 12, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. nrm
    Replies:
    3
    Views:
    513
  2. jakester
    Replies:
    3
    Views:
    1,795
    jakester
    Apr 3, 2007
  3. Replies:
    0
    Views:
    171
  4. Jens Peter Hansen
    Replies:
    7
    Views:
    493
    Randy Webb
    Jun 19, 2004
  5. Nigel Molesworth

    Resize an existing popup window

    Nigel Molesworth, Jun 24, 2005, in forum: Javascript
    Replies:
    0
    Views:
    101
    Nigel Molesworth
    Jun 24, 2005
Loading...

Share This Page