一种在父窗口中得知 window.open()出的子窗口关闭事件的方法(定时器实现)
发表于:2007-06-30来源:作者:点击数:
标签:
parent.htm :br br lt;HTMLgt;lt;BODYgt;br lt;Pgt;nbsp;lt;/Pgt;br lt;form name=fm_Infogt;br lt;input type=text name=txtValuegt;br lt;/formgt;br lt;script language= java scriptgt;br var timerbr var winOpenbr function IfWindowClosed() {br nbsp;
parent.htm :<br>
<br>
<HTML><BODY><br>
<P> </P><br>
<form name=fm_Info><br>
<input type=text name=txtValue><br>
</form><br>
<script language=
javascript><br>
var timer<br>
var winOpen<br>
function IfWindowClosed() {<br>
if (winOpen.closed == true) { document.fm_Info.txtValue.value="child closed"<br>
window.clearInterval(timer)<br>
}<br>
}<br>
</script><br>
<input type=button name=btnOpen value=open><br>
<br>
<script language=javascript for=btnOpen event=onclick><br>
document.fm_Info.txtValue.value=""<br>
winOpen=window.open("child.htm","","toolbar=no, location=no, directories=no, status=no, menubar=no" )<br>
timer=window.setInterval("IfWindowClosed()",500);<br>
</script><br>
</BODY></HTML><br>
------------------<br>
There can be anything in child.htm<br>
原文转自:http://www.ltesting.net