window.close()
will close the current window. If you want to close the opened window popup try following the below approach.
Assuming you are opening a popup with a reference like below (Parent.aspx)
var windowObjectReference;
var strWindowFeatures = "menubar=yes,location=yes,resizable=yes,scrollbars=yes,status=yes";
function openRequestedPopup() {
windowObjectReference = window.open("mypage", "Popup Page", strWindowFeatures);
}
For closing a popup (child.aspx)
btnCancel.Attributes.Add("onclick", "parent.closePopup();");
Then (parent.aspx)
function closePopup()
{
windowObjectReference.close();
}
Refer window.open
and window.close()