You can execute a function in the parent window and send parameters with that function from the newly opened window.
The parent window would then be window.opener
, and the function in the parent would be global i.e. in the window scope, and you can call that function from the opened window with window.opener.myFunction(parameters, from, myPopup);
This means that you would write the onclick event handlers in the newly opened window, and on click call a function in the parent window passing along the data of your choosing as a parameter to the function in the parent window.
Here's a DEMONSTRATION