The request is quite questionable. Why doing so?
However, these pages will give you the idea:
http://www.w3schools.com/jsref/obj_window.asp[
^],
http://www.w3schools.com/jsref/met_win_close.asp[
^],
http://stackoverflow.com/questions/6622461/how-to-capture-browser-close-event-in-javascript[
^].
Does it make your problem clear?
[EDIT]
As we had a little argument with aspnet_regiis, this is the code I've just tested, so it proves my point:
<html>
<head>
<title>Child window and window.onbeforeunload demo</title>
<script language="Javascript"></script>
</head>
<body>
<script language="Javascript"></script>
<button accesskey="S" onClick="Show()"><u>S</u>how</button></br>
</body>
</html>
By the way, despite of my initial comment, closing a "parent" window from a child one is also possible, due to the property
opener
:
http://www.w3schools.com/jsref/prop_win_opener.asp[
^].
—SA