Please make sure you allow popups or this won't open a window...
This opens a window to test the windows.close method below:
The window opener:
<script language="javascript">
function open_a_window()
{
window.open("window_to_close.htm");
return false;
}
</script>
<input type="button" onclick="return open_a_window();" value="Open New Window/Tab" />
The window closer:
<script language="javascript">
function quitBox(cmd)
{
if (cmd=='quit')
{
open(location, '_self').close();
}
return false;
}
</script>
<input type="button" onclick="return quitBox('quit');" value="Close This Window/Tab" />