/    Sign up×
Community /Pin to ProfileBookmark

relating between windows with multiple window.open()

I’m trying to find a way to change form data on a page from a page two window.open()s away. :rolleyes: Example:

Original window with form elements
opens
Another window with a form and random numbers
which opens
A small window with the relevant numbers (success or failure), and this window needs to change elements in the Original window.

I would be doing all the changing from the 2nd window, but I have PHP issues in that window, which made me resort to the third window.

Any help?

to post a comment
JavaScript

7 Comments(s)

Copy linkTweet thisAlerts:
@pnajJan 17.2004 — You could try this sort of thing:

Put all javascript functions on the original page on the original page.

e.g

function fun(s){

window.alert(s);

}

Then, call those functions from any window using the 'top' attribute of 'window' ...

window.top.fun();

That seems to work fine ... pretty tidy too!

If you want to see an example ... I've attached a zip.

[upl-file uuid=1c2699e1-d4bd-4da7-8fed-1aa3648b1f0d size=986B]wins.zip[/upl-file]
Copy linkTweet thisAlerts:
@Khalid_AliJan 17.2004 — [url=http://www.webapplikations.com/pages/html_js/window/ParentWinInteractionWithChildWin.html]I think this is what you are looking for[/url]
Copy linkTweet thisAlerts:
@khayman2001authorFeb 20.2004 — Sorry its taken me so long to get back to you, but your example doesn't work. You have the function on both win1 and win3, and if you remove it from 3, it doesn't work.
Copy linkTweet thisAlerts:
@KorFeb 20.2004 — you are on page 2. Now:

  • 1. To change something on page 1, reference is:


  • window.opener. ...

  • 2. To change something on page 3, put the refence [b]in[/b] the page 3 , and from there use the same


  • window.opener. ...

    Better use javascript window.open() code for both opened windows to get a correct reference.
    Copy linkTweet thisAlerts:
    @khayman2001authorFeb 20.2004 — I want to change something on page 1 from page 3, though.
    Copy linkTweet thisAlerts:
    @KorFeb 20.2004 — This case

    window.opener.window.opener. ...

    is the ref

    but you can manage somehow even the "this" parameter to do that
    Copy linkTweet thisAlerts:
    @khayman2001authorFeb 21.2004 — Thank you, so much! This was exactly what I was looking for. I didn't know you could relate to the opener attribute from another window, although I didn't try, either. Thanks again.

    ? ?
    ×

    Success!

    Help @khayman2001 spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 6.16,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @nearjob,
    tipped: article
    amount: 1000 SATS,

    tipper: @meenaratha,
    tipped: article
    amount: 1000 SATS,

    tipper: @meenaratha,
    tipped: article
    amount: 1000 SATS,
    )...