别人的:
<html>
<head>
<title>无标题文档</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head><body scroll=no leftmargin=0 topmargin=0 valign=top oncontextmenu="return false;">
<OBJECT id="min" type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">
<PARAM name="Command" value="Minimize"></OBJECT>
<script>
var openwinflag;
function freezwy()
{
     openwinflag=window.open(top.location,'freezwy_tj','fullscreen=0,toolbar=no,scrollbars=no,resizable=1,menubar=no');
    window.focus();
    document.min.Click();
}
if(window.name != "freezwy_tj")
{
  freezwy();
  openwinflag.resizeTo(800,600);
     openwinflag.moveTo(0,0);
}function closewin()
{
   openwinflag.close();
  self.close();
 }
</script>
<input type="button" name="Submit" value="关闭" onclick="closewin()">
</body>
</html>

解决方案 »

  1.   


    <SCRIPT LANGUAGE=javascript>
    <!--
    function closeWindow()
    {
    if (typeof(window.parent)!='object')
    window.close();
    setTimeout("closeWindow()",100);
    }
    closeWindow();//-->
    </SCRIPT>
      

  2.   

    parent是针对分帧(frame)的情况,不可能parent frameset关闭了child frame还开着检测父窗口是否关闭使用:if(window.opener==null)
    alert("已关闭")
    else
    alert("还没关")
      

  3.   

    楼上的也可以实现!但我觉得响应主窗口的unload事件是最好的一种方式!在unload处理中,close子窗口!
      

  4.   

    如果知道onunload是刷新时触发的还是关闭时触发的?
      

  5.   

    <script>
    function window.onbeforeunload(){
    with(event){
    if(clientX>document.body.clientWidth &&clientY<0||altKey)
    alert("Are u sure to close?")
    else
    alert("Are u sure to refresh?")
    }
    }
    </script>