2

I have a page in which i m calling another popup by window.open method. The only thing how can i change a label in opener page from popup page while the popup page is still alive ie which is not closed yet

brtb
  • 2,201
  • 6
  • 34
  • 53

3 Answers3

1

It's better to let the opener window take care of changing values by exposing a small API to the popup window.

I've outlined it here: javascript - pass selected value from popup window to parent window input box

Community
  • 1
  • 1
Ja͢ck
  • 170,779
  • 38
  • 263
  • 309
0

It should be like this:

window.opener.document.getElementById('label1').value = "the new value";
Doruk
  • 884
  • 9
  • 25
0
<script>
function myFunction() {
    var additionalWindow = window.open("/additional");

    // Write on the additional window
    additionalWindow.document.write('written from separate window');

    // Call a function on the additional window
    additionalWindow.someFunction();
}
</script>

Here's Mozilla's documentation on window.open().

aralar
  • 3,022
  • 7
  • 29
  • 44