You may have a collision in the names. You have a variable PopupWnd and the name of the window PopupWnd.
var PopupWnd = null; function
ShowPopup(){
PopupWnd = window.open('Popup.aspx','PopupWindow','');
}
function HidePopup(){
if(PopupWnd != null){
if(!PopupWnd.closed){
PopupWnd.close();
}
}
}
That should work as the WindowName no longer collides with the variable. I'd suggest checking out http://www.infimum.dk/HTML/JSwindows.html for a more indepth view on window manipulation using javascript.
In a case like this, I'd also suggest Line by Line testing and doing things such as throwing out an alert i.e. do an alert after if PopupWnd != Null to see if it even reaches that part. Hell, do an alert right at th ebeginning of the HidePopup function to see what the value of PopupWnd is...
CogitoErgoSum
2010-07-22 18:54:53