欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

一种在父窗口中得知window.open()出的子窗口关闭事件的方法

程序员文章站 2023-12-01 21:30:16
parent.htm :

parent.htm :

<html><body>
<p> </p>
<form name=fm_info>
<input type=text name=txtvalue>
</form>
<script language=javascript>
var timer
var winopen
function ifwindowclosed() {
if (winopen.closed == true) { document.fm_info.txtvalue.value="child closed"
window.clearinterval(timer)
}
}
</script>
<input type=button name=btnopen value=open>

<script language=javascript for=btnopen event=onclick>
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);
</script>
</body></html>
------------------
there can be anything in child.htm