<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!--
There are six slightly different scripts below. In cases
where images are used, replace the image name with the
name of your own image.
Other than that, just insert the code as shown into your
page <body> wherever you wish the closing link, image,
or button to appear.
Special Note on Frameset Pages:
Closing windows that are comprised of a frameset requires
that you ask to close the "topmost" window, *not* the
page that contains the JavaScript closing code. Thus,
where window.close() will work fine with a regular page,
it will often fail (depending on the browser) when
attempting to close a window comprised of frameset pages.
In this case, the JavaScript closer must ask for
top.window.close() instead.
Other Background:
Before you ask... if a window is *not* a popup to begin
with, window.close() JavaScript calls will normally
result in a browser message requesting confirmation
that you wish to close the window. There is no means
in most browsers to avoid or circumvent this.
-->
<!--
1. Closing a Regular Window from a Link Click
---------------------------------------------
-->
<a href="javascript:window.close()">Close</a>
<!--
2. Closing a Regular Window from an Image Click
-----------------------------------------------
-->
<script language="JavaScript">
function unload(){
if (event.clientY < 0) {
event.returnValue = 'Do you want to close windows';
}
}
window.onbeforeunload = unload;
</script>