在使用frameset页面时,我们常常在选中左边的菜单的页面按F5键时,刷新的 左边的菜单页面,而不是中间页面,同理在顶部底部都一样的道理,所以需要在那些页面屏蔽下F5,并且让主页面刷新
document.onkeydown = function(e){ var ev = e ? e :event; if(window.addEventListener){ if(ev.keyCode==116){ parent.frames['mainframe'].location.reload(); ev.preventDefault(); } }else{ if(ev.keyCode==116){ ev.keyCode=0; ev.returnValue=false; parent.frames('mainframe').location.reload(); } } }
html页面中的frameset
<frameset rows="104,*,29" frameborder="no" border="0" framespacing="0">
<frame src="${ctx}/admin/common/back-header.action" name="topFrame" scrolling="no" style="width:100%;height:104px;visibility:inherit;z-index:1;margin:0;padding:0;border:none;" noresize>
<frameset cols="203,6,*" frameborder="no" border="0" id=main_frm >
<frame src="${ctx}/admin/common/leftmenu.action" name="leftframe" id=leftFrame scrolling="auto" noresize>
<frame src="${ctx}/admin/common/framecontrol.action" name=navframe noResize scrolling=no>
<frame src="${ctx}/admin/common/admin-main.action" name="mainframe" scrolling="auto" noResize>
</frameset>
<frame src="${ctx}/admin/common/bottom.action" name="bottomframe" scrolling="no" noresize="noresize" id="bottomframe" title="bottomframe" />
</frameset>