父页面index.html中打开窗口:
// index.html
function openwindow(){
var iWidth=700;
var iHeight=450;
var iTop = (window.screen.availHeight-30-iHeight)/2;
var iLeft = (window.screen.availWidth-10-iWidth)/2;
var h = {
size: "height="+iHeight+", width="+iWidth+", top="+iTop+", left="+iLeft
};
var url = "http://www.test.com/test.html";
window.open(url, "", h.size);
}
小窗口的test.html页面指定时机写上以下代码
// test.html
if(window.opener){
window.opener.top.location.href = "http://www.test.com/index.html";
}
window.close();
即可关闭小窗口,刷新父窗口