一 实例分析
上图的竞价大厅为open方法打开的一个window,内嵌的frame结构如下
------------------------------竞价大厅页面-ShowFpgldtFrame.html---------------------------
name="FpgldtFrame" rows="40,*,150" framespacing="0"
frameborder="no" border="0">
src="ognl:request.contextPath+'/eps/public/dzjj/FpdtTitle.html?bbh='+bbh"
id="Fpgldttop" name="Fpgldttop" scrolling="no" noresize
marginwidth="0" marginheight="0" />
name="Fpgldtmiddle" cols="*,12,18%" framespacing="0"
frameborder="no" border="0">
src="ognl:request.contextPath+'/eps/public/dzjj/ShowCgrdtFrame.html?xmxh='+xm_zbxm_id+'&bbh='+bbh"
id="leftFrame" name="leftFrame" scrolling="no" noresize
marginwidth="0" marginheight="0"
/>
src="ognl:request.contextPath+'/eps/public/dzjj/rshift.html'"
id="sFrame" name="sFrame" scrolling="no" noresize marginwidth="0"
marginheight="0" />
src="ognl:request.contextPath+'/eps/public/dzjj/ShowGLCZPage.html?xm_zbxm_id='+xm_zbxm_id+'&bbh='+bbh"
id="rightFrame" name="rightFrame" scrolling="no" noresize
marginwidth="0" marginheight="0" />
src="ognl:request.contextPath+'/eps/public/dzjj/ShowFpIM.html?xmxh='+xm_zbxm_id+'&bbh='+bbh"
id="Fpgldtbottom" name="Fpgldtbottom" scrolling="no" noresize
marginwidth="0" marginheight="0" />
---------------------------ShowCgrdtFrame.html------------------------------------------
cols="180,15,*" frameborder="no" border="0"
id="MainFrameset" name="MainFrameset"
framespacing="0">
src="ognl:request.contextPath+'/eps/public/dzjj/ListFpgz.html?xmxh='+xmxh+'&bbh='+bbh"
name="ListFpgz" scrolling="No" noresize="noresize" width="200"
id="ListFpgz"
/>
id="shiftFrame" name="shiftFrame" marginWidth="0" marginHeight="0"
frameBorder="0" width="12" src="shift.html" scrolling="no"
/>
src="ognl:request.contextPath+'/eps/public/dzjj/ListGysBJ.html?xmxh='+xmxh+'&bbh='+bbh"
name="ListGysBJ" id="ListGysBJ"
scrolling="yes"/>
----------------------------------------------------------------------------------------
解决办法:opener.parent.frames['leftFrame'].frames['ListFpgz'].form.submit();
二 其他方法刷新方法
οnclick="javascript:window.location.reload();"
value="单击" id="btnVCode" />
οnclick="javascript:window.location.href=window.location.href;"
value="单击" id="btnVCode" />
都提交数据
window.location.Reload()应该是刷新.(如果有数据提交的话,会提示是否提交的(是和否选项))
window.location.href=window.location.href; 是定向url提交数据
最好不要用location.reload(),而用location=location比较好,还有在模式窗口(showModalDialog和showModelessDialog)前者不能用。
function refresh()
{
//刷新页面函数
//window.focus();刷新窗口
//document.execCommand("Refresh");刷新窗口
//self.location.reload();刷新当前窗口
parent.location.reload();刷新父窗口
//aaa.location.reload();弹出窗口刷新父窗口
} 使用window.location.replace() or window.location.href(),
来重新加载此页面不出现提示框
iframe框架的页面跳转 var win =
self.parent.document.getElementByIdx_x('right').contentWindow;
win.document.location.href = "VipManage.jsp";
==========================================================================
"window.location.href"、"location.href"是本页面跳转
"parent.location.href"是上一层页面跳转
"top.location.href"是最外层的页面跳转
举例说明:
如果A,B,C,D都是jsp,D是C的iframe,C是B的iframe,B是A的iframe,如果D中js这样写
"window.location.href"、"location.href":D页面跳转
"parent.location.href":C页面跳转
"top.location.href":A页面跳转
如果D页面中有form的话,
: form提交后D页面跳转target="_blank">: form提交后弹出新页面
target="_parent">: form提交后C页面跳转
target="_top"> : form提交后A页面跳转
关于页面刷新,D 页面中这样写:
"parent.location.reload();":
C页面刷新 (当然,也可以使用子窗口的 opener
对象来获得父窗口的对象:window.opener.document.location.reload(); )
"top.location.reload();": A页面刷新