我正在創建一個轉到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>
請檢查此:http://stackoverflow.com/questions/18321323/submit-form-reload-parent-and-close-child/36855748#36855748可能會幫助某人 – NoNaMe 2016-04-26 05:17:05