2013年9月20日星期五

How close is executed after the window.open js function

using window.open , the need off execute a js method


As the pop-up interface it needs to download files via streaming using window.open,
with window.showmodaldialog not download files
------ Solution ----------------------------- ---------------
in the open window unload event write code chant.
------ Solution ---------------------------------------- ----
only by calling the child window 's parent window way to achieve
------ Solution ----------------------- ---------------------

<html>
<head>
<script type="text/javascript">
function open_win() 
{
window.open("open.html")
}

function test(){
alert("parent");
}
</script>
</head>

<body>
<form>
<input type=button value="打开窗口" onclick="open_win()">
</form>
</body>

</html>







<html>
<head>
<script type="text/javascript">
function test(){
alert("close");
}
</script>
</head>

<body onunload="window.opener.test()" onbeforeunload ="test()">
<form>
</form>
</body>

</html>


没有评论:

发表评论