<input type="button" value="Has 'myWindow' been closed?" onclick="checkWin()" />
<html>
<head>
<script type="text/javascript">
function ifClosed()
{
document.write("'myWindow' has been closed!")
}
function ifNotClosed()
document.write("'myWindow' has not been closed!")
function checkWin()
if (myWindow.closed)
ifClosed()
else
ifNotClosed()
</script>
</head>
<body>