子窗口刷新父窗口然后关闭

1 history.go(0) 

2 location.reload() 

 3 location=location 

 4 location.assign(location)

 5 document.execCommand(‘Refresh’) 

 6 window.navigate(location) 

 7 location.replace(location) 

 8 document.URL=location.href 

这几个都可以刷新

下面是参考代码

 

========================页面A================

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

 

<html>

<head>

<title>a</title>

<script>

       function openb(){

       window.open("http://127.0.0.1:8080/bomc/bb.jsp")

       }

    </script>

</head>

 

<body>

 

<input type=’button’ onclick=’openb();’ id=’test’ value=’打开子窗口’/>

<%=new Date().toLocaleString() %>

</body>

</html>

=========================页面B===========================

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

 

<html>

<head>

<title>b</title>

    <script language="JavaScript" type="text/javascript"> 

<!– 

function refreshParent() { 

alert(‘父窗口刷新并将关闭本页!’);

window.opener.location.href = window.opener.location.href; 

if (window.opener.progressWindow) 

window.opener.progressWindow.close(); 

window.close(); 

} //–> 

</script> 

</head>

 

<body>

<input type=’button’ onclick=’refreshParent();’ id=’test’ value=’确认’/>

<input type=’button’ onclick=’window.close();’ id=’test’ value=’取消’ />

<%=new Date().toLocaleString() %>

</body>

</html>

发表评论

电子邮件地址不会被公开。 必填项已用 * 标注

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>