日期:2014-05-17 浏览次数:20979 次
<frameset rows="64,9*,1*" frameborder="NO" border="0" framespacing="0">
<frame src="<%-- ${pageContext.request.contextPath } --%>toMainTop" noresize="noresize" frameborder="NO" name="topFrame" scrolling="no" marginwidth="0" marginheight="0" target="mainFrame" />
<frameset cols="200,*" rows="100%" id="frame">
<frame src="toMainLeft" name="leftFrame" id="leftFrame" noresize="noresize" marginwidth="0" marginheight="0" frameborder="0" scrolling="no" target="mainFrame" />
<frame src="toMainRight" name="mainFrame" id="mainFrame" marginwidth="0" marginheight="0" frameborder="0" scrolling="auto" target="_self" />
</frameset>
<frame src="toMainButtom" name="buttomFrame" noresize="noresize" marginwidth="0" marginheight="0" frameborder="no" scrolling="no" target="mainFrame"/>
</frameset>
//按下F5时,只刷新mainFrame,兼容IE、FF
function myKeyDown(e) {
var ev = e ? e:event;
if(window.addEventListener) {
if(ev.keyCode == 116) { //F5的键盘常用ASCII码为116
parent.frames['mainFrame'].location.reload();
ev.preventDefault();
return false;
}
} else {
if(ev.keyCode==116) {
ev.keyCode=0;
ev.returnValue=false;
parent.frames('mainFrame').location.reload();
return false;
}
}
}
//给每个frame都绑定onkeydown事件?
window.onload = function() {
document.onkeydown = mykeyDown;
for(var i=0;i<frames.length;i++) {
if(typeof document.addEventListener != "undefined") {
frames[i].document.addEventListener("keydown",myKeyDown,true);
} else {
frames[i].document.attachEvent("onkeydown", myKeyDown);
}
}
}