日期:2014-05-16 浏览次数:20391 次
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>父窗口</title>
<script type="text/javascript">
function fun(thisurl) {
window.open(thisurl,"弹出页面","width=470,height=150,scrollbars=yes,resizable=no");
}
/*计算页面刷新次数*/
window.onload = function()
{
if(window.name==""){
window.name = "0";
}
else{
window.name = eval(window.name) + 1;
alert("已经刷新"+ window.name+'次');
}
}
</script>
</head>
<body>
<input type="button" value="打开" onClick="fun('opendemo.html')" />
</body>
</html>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>子窗口</title>
<script type="text/javascript">
function closeWin() {
window.close();
}
/*刷新父窗口页面*/
window.opener.location.reload();
</script>
</head>
<body>
<h3><a href="#" onClick="closeWin()">关闭窗口</a></h3>
</body>
</html>