Close Current Window

Close Another Window

You can also close another window. That is, a different window to the one that the "Close" button is located on.

The following JavaScript code includes a function to open the window, and another function to close the window that was just opened. To close the window, we use the window's name (the name that we gave it when we opened the window). In this case, we called our window popupWindow.

Note that you may need to click "Close Popup Window" twice - the first click will bring this window back into focus and the second click will click the actual button.