Are you new? Read the FAQ and catch up on!
2k views

Call a function in the parent window of a pop-up

First, define the function you want to call from the pop-up in the parent window:

Javascript
  1. function functionInParent()
  2. {
  3.     // ...
  4. }
  5.  

­

Then, in the pop-up:

Javascript
  1. // ...
  2. if (window.opener && !window.opener.closed)
  3. {
  4.     window.opener.functionInParent();
  5. }
  6. // ...
  7.  

­

Tags: JavaScript pop-up

Embed: