The popup windows are used in order to allow the user to open a document pages in separate windows. when the user try's to open next document pages all the previous document pages windows must closed. So basically, I want to close multiple popup windows. In order to save the reference of popup window opened, I have saved the array containing popup windows reference in a variable and the value of that variable is saved in a hidden field.Now popup = window.open('', '', sOptions); returns [object] and when this [object] is retrieved it generates an error that object doesn't support this property or method. Im using the following javascript in my web application developed using asp/vb.net.var popupWin = new Array();\[code\]function OnPopupClick(url,title,name) { var popup = null; var sOptions; sOptions = 'status=yes,menubar=no,scrollbars=yes,resizable=yes,toolbar=no,titlebar=yes,location=0,directories=0'; sOptions = sOptions + ',width=' + (screen.availWidth - screen.availWidth / 2).toString(); sOptions = sOptions + ',height=' + (screen.availHeight - 50).toString(); sOptions = sOptions + ',screenX=0,screenY=0' sOptions = sOptions + ',left=' + ((screen.availWidth / 2) - 10).toString(); sOptions = sOptions + ',top=0'; html = '<html><head><title>'+ title + '</title></head><body style="margin: 0px 0; text-align:center; "><IMG src="' + url + '" BORDER=0 NAME=image height="' + (screen.availHeight - 50).toString() +'" width="' + ((screen.availWidth - screen.availWidth / 2)-20).toString() +'" onload="window.resizeTo((document.image.width-(document.image.width-(screen.availWidth - screen.availWidth / 2)))+10,((document.image.height*1.3)-(screen.availHeight - 50))+((screen.availHeight - 50)*3)";></body></html>'; popup = window.open('', '', sOptions); popup.document.open(); popup.document.write(html); popup.document.focus(); popup.document.close(); if(document.getElementById('<%= hidTitle.ClientID %>').value!=name){ ClosePopupWin(document.getElementById('<%= hidWinRef.ClientID %>').value); } TrackPopupWinOpen(popup,name); } function TrackPopupWinOpen(winName,title) { popupWin[popupWin.length] = winName; var index = popupWin.length-1; var val = popupWin.join(); document.getElementById('<%= hidWinRef.ClientID %>').value=http://stackoverflow.com/questions/12659812/val; document.getElementById('<%= hidTitle.ClientID %>').value=http://stackoverflow.com/questions/12659812/title; } function ClosePopupWin(retVal) { popupWin[popupWin.length]=retVal.split(); var openCount = popupWin.length; for (i = 0; i < openCount; i++) { popupWin.close(); } }\[/code\]What am I doing wrong?I cant use any third part tools. I can only use controls available in asp.