SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Member
    Join Date
    Nov 2002
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Window Not Recognizing Other Windows...

    Okay...
    Here is the problem...

    I have page1.html which creates a window called defineIt, I know that from page1.html I can call functions in defineIt through using say defineIt.FunctionA();.

    Now, if someone goes from page1.html to page2.html (via a link), how can page2 call a "defineIt.FunctionA()"? Page2.html did not create the window, and from what I have been testing in IE and Netscape, page2.html does not recognize the window defineIt.

    Is there anyway around this?

    Thanks in Advance!

    Mark
    ------------------
    I have page1.html which has:

    defineIt = window.open('defineIt.html', 'GuerillaDef', 'width=300,height=185,status=yes');
    and i call the function on defineIt.html with

    defineIt.FunctionA();
    This works, until, I go from page1.html to page2.html. There, page2.html no longer recognizes defineIt.

  2. #2
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use a frameset, with height=0 for the first frame, and open page1.html in the second frame
    Put the window.open functions and vars in the page that never changes (the one in the "hidden" frame)

  3. #3
    SitePoint Enthusiast
    Join Date
    Dec 2002
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by jofa
    Use a frameset, with height=0 for the first frame, and open page1.html in the second frame
    Put the window.open functions and vars in the page that never changes (the one in the "hidden" frame)

    *anti-frames*

    I hate frames to death, but...that's probally the only way to do it, eh...only way I can think of anyway.
    -Mark

  4. #4
    SitePoint Enthusiast
    Join Date
    Dec 2002
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Question, for the soul purpose of knowlege, after you open a window like that, how do you have the window that was opened, in this case defineIt, call back to the primary window, which opened it? To do functions in the opened I know you do definteIt.function(), but what from that to the main?

    Figured I'd just ask here instead of making a new post, since this is on the subject, and wouldn't have thought to ask if this wasn't here.
    -Mark

  5. #5
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    window.opener.some_function()


    Or window.opener.top.frames[0].some_function() in the frameset case

  6. #6
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Maybe there is a non-frameset way to do it...
    When you open a new window with window.open(), the second parameter is the name of the window, and I guess the idea is that you should be able to reference a window using it's name (e.g. if the reference returned from window.open() is out of scope after moving from page1.htm to page2.htm in the opening window).

    But, I must confess, I have never really understood how the "window name thing" works in javascript...
    Sometimes I get (a ref to) the already open window, sometimes a new window is opened

  7. #7
    ♪♪ ♪ ♪ ♪ ♪♪ ♪ ♪♪ Markdidj's Avatar
    Join Date
    Sep 2002
    Location
    Bournemouth, South UK
    Posts
    1,551
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    similar problem......

    I have just created an 'open window' function for an animated page. It opens the current animation from the current page into a new window, and lets the user change the 'opener' animation while the new animation in the new window continues, sychronised with the opener.

    As the opener contains the clock for sychronisation, I can only use the animations from that page (and I have a few pages of small animations). I can let the new animation on the new page continue with its own clock if the opener is closed, but what I would like is if a new animation is started from a new opener, then it tells the existing opened window the new page speed.........

    got it?????
    try here
    follow steps.....
    1; open new window
    2; click on drum in new window to turn on
    3; start rhythm by clicking on hands in main window

    I can change between rhythms, so long as I stay on the main page. The problem is when I change the main page to go to other rhythms I loose the sychronisation.

    I can go to another page(from opener) and put a new rhythm in the current new window, but I would prefer to keep the old rhythm and sychronise.

    I also prefer not to use frames.

    thanks
    LiveScript: Putting the "Live" Back into JavaScript
    if live output_as_javascript else output_as_html end if

  8. #8
    ♪♪ ♪ ♪ ♪ ♪♪ ♪ ♪♪ Markdidj's Avatar
    Join Date
    Sep 2002
    Location
    Bournemouth, South UK
    Posts
    1,551
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    A thought.......

    The top.location changes when you change to page2.htm,
    so you might be able to get this from your new window, then in your new window, if top.location changes trigger a new function....

    something to play with
    LiveScript: Putting the "Live" Back into JavaScript
    if live output_as_javascript else output_as_html end if

  9. #9
    ♪♪ ♪ ♪ ♪ ♪♪ ♪ ♪♪ Markdidj's Avatar
    Join Date
    Sep 2002
    Location
    Bournemouth, South UK
    Posts
    1,551
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    DOH!!!!!!

    top.location of new window is new window!!!!!
    LiveScript: Putting the "Live" Back into JavaScript
    if live output_as_javascript else output_as_html end if


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •