我正在创建一个弹出窗口,它会跳转到hello.html页面。当我关闭弹出窗口(hello.html)时,我希望我的原始页面(父级页面)重新加载。我似乎无法让它工作,但我已经接近成功了。以下是我目前为止为主页面和hello.html 页面编写的代码....
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function open_win()
{
window.open("hello.html","_blank","toolbar=yes, location=yes, directories=no, status=no, menubar=yes, scrollbars=yes, resizable=no, copyhistory=yes, width=400, height=400");
}
</script>
<script language="JavaScript">
function refreshParent() {
window.opener.location.href = window.opener.location.href;
if (window.opener.hello.html)
{
window.opener.hello.html.close()
}
window.close();
}
</script>
</head>
<body>
<script type="text/javascript">
var d=new Date();
document.write(d);
</script>
<form>
<input type="button" value="Open Window" onclick="open_win()">
</form>
</body>
</html>
这里是hello.html的内容:
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
</script>
</head>
<body>
Hello
</body>
</html>