Reputation: 4047
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
Reputation: 8401
You should use window.parent
to refer to the parent page.
What you are doing will open a new window.
Upvotes: 2