日期:2014-05-17  浏览次数:20681 次

模态对话框中嵌套frame问题
一个模态对话框,里面是一个frameset,如下:

HTML code
<frameset width="100%" height="100%"  rows="210,*" bordercolor="#7F9DB9" frameborder="YES" framespacing="0" border="0" framespacing="0">
    <frame name="topFrame"  scrolling="AUTO" src="../../bugPlanDispacthAction.do?billId=<%=billId%>&type=<%=type%>" />
    <frame name="paramMain" src="" scrolling="auto" />
</frameset>



现在想实现点击paramMain中的一个按钮,刷新topFrame页面,我使用如下几种方法刷新,但是不能刷新成功
window.parent.frames(0).location.reload();
window.parent.frames.topFrame.location.reload();
window.parent.frames.item(0).location.reload();
window.parent.topFrame.location.reload();

后来把frameset从模态对话框中拿出来,放入一个普通的页面,可以刷新成功,不知是什么原因导致了这种情况的出现?有没有解决办法?

------解决方案--------------------
父页面写一个js方法,用于刷新框架topFrame
function refreshTop(){
document.frames("topFrame").document.location.reload(true);
}

在框架paramMain写一个函数
function main_refreshTop(){
window.parent.refreshTop(tips);
}

当在paramMain中需要刷新top时,调用方法main_refreshTop()
------解决方案--------------------
探讨
问题解决了,使用如下语句可以:
window.parent.frames.topFrame.location.href=window.parent.frames.topFrame.location.href;

但是不知道为什么使用如下语句不可以:
window.parent.frames(0).location.reload();
window.parent.frames.topFr……