I have a jsp page with frames
<%@ include file="/includes/taglibs.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<title>Welcome</title>
<script type="text/javascript" src="/js/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$(this).keydown(function(e) {
if(e.keyCode==27){
alert("escape pressed");
e.preventDefault();
}
});
}
);
</script>
</head>
<frameset rows="42,*" frameborder="0" framespacing="0" id="framest">
<frame src="/xyz/abc.html" scrolling="no" name="frame1"/>
<frame src="/xyz/init.html" scrolling="no" name="frame2"/>
</frameset>
</html>
I am trying to capture escape key press. But this doesn't seem to work. On each individual frame html if I write the same code of capturing , it works perfectly fine.
What changes should I make in the code above so that I would write the keydown code just once which enables me to capture keydown on anywhere on page on any frame.