Understanding window.close()

I am trying to understand what window.close() does?
Up to now I have been using show/hide because if I use close() and try to open the window again I get an error message.

After examining the window variable in debugging mode I see that after calling the close() method the window object still exists, and it seems necessary to set window = null.

In my code I have:
var undef, window; // undef is never assigned a value

function openWindow() {
if (window == undef) {
window = dhxWins.createWindow(“win”, 0, 0, 800, 600);

window.button(“close”).attachEvent(“onclick”, function() { closeWindow() });


function closeWindow() {


On my one page I have over 30 different windows. Some containing grids, some containing objects (divs) and now I need to add one that attaches a URL.

What is the correct way to create/close windows, so as to free up the client’s memory (including attached objects), but if necessary be able to reopen the window?

close() method removes a window and its content. So, if you need to reopen a window and use the same content, it would be better to use hide()/show() methods.