I have a Parent window with two radio buttons (Yes and No) and a Submit button. If the user selects No and clicks the Submit button, a popup child window will appear. Is there a way to dynamically close the child page if let's say, the user clicks the Yes button in the parent window and clicks Submit while the child window is still open?
Below is the code of my test javascript. It correctly pops up the child window if I click No and then submit. But if the child is already open and if I go back to my parent window and click Yes, my child window is not closing because the g_windowOpener variable is not recognized.
function OpenWindow()
{
var optionNo = document.getElementById('<%= rbNo.ClientID %>').checked;
if (optionNo == true)
{
g_windowOpener = window.open('frmPopup.aspx', 'mywindow','hotkeys=no,width=800,height=600,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,copyhistory=no,resizable=yes');
}
else
{
g_windowOpener.close();
}
}
thanks in advance!