87,910
社区成员
发帖
与我相关
我的任务
分享
window.opener=null;
window.open('','_self');
window.close();
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<script type="text/javascript">
var pWin = window.opener ? window.opener.getTopWindow() : window;
function getTopWindow(){
return pWin;
}
function openWin(){
var win = window.open(window.location.href);
//alert(win.getTopWindow);
(function(){
if(win.getTopWindow){
document.ff.submit();
window.opener=null;
window.open('','_self');
window.close();
}else{
setTimeout(arguments.callee, 100);
}
})();
}
function show(){
getTopWindow().document.getElementById("t").innerHTML = new Date().toLocaleString();
}
</script>
<form action="ceshi.jsp" name="ff">
<div id="t"></div>
<input type="button" value=" 新建窗口 " onClick="openWin()" />
<input type="button" value=" 第一个窗口刷新时间 " onClick="show()" />
</form>
</body>
</html>