---
title: "在父窗口中得知 window.open()出的子窗口关闭事件的方法（定时器实现)"
author: "249080378"
date: "2010-03-30T16:24:16Z"
tags: []
categories: ["编程语言"]
slug: "window-open"
draft: false
lastmod: "2010-03-30T16:24:16Z"
id: 628348
url: "https://249080378.iteye.com/blog/628348"
---

&lt;HTML&gt;&lt;BODY&gt;  
&lt;P&gt; &lt;/P&gt;  
&lt;form name=fm\_Info&gt;  
&lt;input type=text name=txtValue&gt;  
&lt;/form&gt;  
&lt;script language=javascript&gt;  
var timer  
var winOpen  
function IfWindowClosed() {  
    if (winOpen.closed == true) {        document.fm\_Info.txtValue.value="child closed"  
    window.clearInterval(timer)  
    }  
}  
&lt;/script&gt;  
&lt;input type=button name=btnOpen value=open&gt;

&lt;script language=javascript for=btnOpen event=onclick&gt;  
document.fm\_Info.txtValue.value=""  
    winOpen=window.open("child.htm","","toolbar=no, location=no, directories=no, status=no, menubar=no" )  
    timer=window.setInterval("IfWindowClosed()",500);  
&lt;/script&gt;  
&lt;/BODY&gt;&lt;/HTML&gt;

本文来自CSDN博客，转载请标明出处：[http://blog.csdn.net/21aspnet/archive/2007/03/21/1535764.aspx](http://blog.csdn.net/21aspnet/archive/2007/03/21/1535764.aspx)