<script>
sub=null;
function check()
{
try
{
if(window.name=="newwin"||sub.name=="newwin")
alert("exist");
else
alert("not exist");
}
catch(e)
{
alert("not exist");
}
}
</script>
<input type=button value=open onclick='sub=window.open("","newwin","")'>
<input type=button value=close onclick='try{sub.close();}catch(e){}'>
<input type=button value=checkwin onclick=check()>