当前位置: 代码迷 >> Java Web开发 >> 子类窗口关闭父类窗口刷新IE下无效果火狐下可以高手帮改下,该如何处理
  详细解决方案

子类窗口关闭父类窗口刷新IE下无效果火狐下可以高手帮改下,该如何处理

热度:6539   发布时间:2013-02-25 21:19:14.0
子类窗口关闭父类窗口刷新IE下无效果火狐下可以高手帮改下
<script type="text/javascript">
$(function(){
$('#clcpadd').click(function(){
var str = window.open ("<%=basePath%>clgl/sjwh/clcp_addToForm.jsp",'child','width=830,height=320,left=300,top=200');

})
})
</script>

上面是父类窗口弹出子类窗口的js

<script language="JavaScript" type="text/javascript"> 
<!-- 
function refreshParent() { 

window.opener.location.href = window.opener.location.href; 
if (window.opener.progressWindow) 

window.opener.progressWindow.close(); 

window.close(); 
} //--> 
</script> 
上面这个是子类关闭并刷新父类窗口的代码,为啥火狐下有效果,IE下可以关闭子窗口 而父类窗口不能刷新呢?

说明下我的父类窗口也是个弹窗出来的JS如下:

$(function(){
$('#selectClcp').click(function(){
var str = window.showModalDialog("<%=basePath%>include/form_cllxadd.jsp", "", "dialogWidth=633px; dialogheight=382px; toolbar= no, menubar=no, scrollbars=no, resizable=no, location=no, status=no,top=50,left=50");
//alert(str) ;
if(str!=null&&str!=""){
var strs = str.split(',');
//document.form1.clid.value=strs[0].toString();
document.form1.cpmc.value=strs[3].toString();
document.form1.clmc.value=strs[2].toString();
//document.form1.ssbm.value=strs[6].toString();

}
})
})

------解决方案--------------------------------------------------------
if (window.opener.progressWindow) 

window.opener.progressWindow.close(); 
}
这段代码是干什么用的?难道要把父窗口也关闭了?
如果只是关闭子窗口并刷新父窗口的话就这样:
window.opener.location.reload();
window.close();

------解决方案--------------------------------------------------------
父窗体:
Java code
//打开页面function openNew(){    window.showModalDialog('b' ,window,'dialogWidth:350px;dialogHeight:200px;');}//刷新页面functioncallParentRefresh(){    window.location.reload();  }
------解决方案--------------------------------------------------------
window.opener.location.reload();
用这句不就可以了吗?
  相关解决方案