anvd
anvd

Reputation: 4047

Show message in parent page after closing popup child

I have this code in a child window (popup):

function confirmation() {
  var answer = confirm("Close?")
  if (answer) {
    var popup = window.open('../index.php?accao=some');
    popup.document.getElementById('boxid').style.visibility="visible";
  } else {
    return false;
  }
}

And, in the parent page I have:

<div id="boxid" style="visibility: hidden">Success</div>

What I want is to show the #boxid when I click in the popup to close. Why doesn't this code work?

UPDATE: still not working.

var popup = window.parent;
popup.document.getElementById('boxid').style.visibility="visible";

Upvotes: 0

Views: 1030

Answers (1)

Subir Kumar Sao
Subir Kumar Sao

Reputation: 8401

You should use window.parent to refer to the parent page.

What you are doing will open a new window.

Upvotes: 2

Related Questions