[Javascript] Event object in an iFrame

Paul Cowan dagda1 at hotmail.com
Fri Jun 4 09:03:11 CDT 2004


Hi,

I have an .aspx page which displays, top and left navigation.  This page 
also contains an iFrame which holds the main content. I am using the 
onkeypress and onkeydown events to allow keyboard navigation.  The handlers 
for these events in parent frame.

The only way I can get access is to the event object is to pass the event to 
the parent frame's hanler (shown below).  My question is, is there another 
way to get a hold of this event object??

document.onkeypress = keyPress;
document.onkeydown = keyDown;

function keyPress(){
   window.parent.document.onkeypress(event);
}

function keyDown(){
   window.parent.document.onkeydown(event);
}

Thanks

Paul





More information about the Javascript mailing list