2013-08-12 5 views
1

Я не могу автоматически обновлять родительскую страницу после закрытия дочерней страницы. Я знаю, что этот вопрос задавали раньше, но я не мог решить свою проблему, используя их. Ниже приведена моя родительская страница (parent.php).Не удается перезагрузить страницу после закрытия дочерней страницы

<html> 
<head> 
<script type="text/javascript"> 

var popupWindow=null; 

function child_open() 
{ 

popupWindow =window.open('child_page.html',"_blank","directories=no, status=no, menubar=no, scrollbars=yes, resizable=no,width=600, height=280,top=200,left=200"); 

} 
function parent_disable() { 
if(popupWindow && !popupWindow.closed) 
popupWindow.focus(); 
} 
</script> 

</head> 
<body onFocus="parent_disable();" onclick="parent_disable();"> 
    <a href="javascript:child_open()">Click me</a> 
</body>  

</html> 

и это мой child_page.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<title>Untitled Document</title> 
</head> 

<h1>child page</h1> 

This is the child page 
<body> 

<script> 
    window.onunload = refreshParent; 
    function refreshParent() { 
     window.opener.location.reload(); 
    } 
</script> 
</body> 
</html> 

ответ

0

Сценарий:

function RefreshParentPage() { 
       window.self.close(); 
       window.opener.location = 'your parent page path'; 
       top.location.reload(); 
      } 

HTML:

<a onClick="RefreshParentPage()" href="#">Close Child Page</a>