|Property/method value type:||Function object|
|-||myWindow.onfocus = aHandler|
|-||onfocus = aHandler|
|HTML syntax:||<BODY onFocus="aHandler"> <FRAMESET onFocus="aHandler">|
|Argument list:||aHandler||An event handler function object|
A focus event is caused by the user clicking on the receiving window or frame or the window.focus() method being called. When this event is triggered, an onfocus event handler will be invoked.
The onfocus event handler is a function which is represented by an object that is referred to by this property. Because it is stored in a property, you can change the handler by storing a reference to a different function object in this property. At least, you can on MSIE.
You cannot redefine the value of the window.onfocus property from inside the onfocus function handler. This means you can't modify the onfocus behavior while a focus event is in progress.
The handler is registered either by assigning a function to the onfocus property or by defining it with an HTML tag attribute.
Displaying an alert(), confirm() or prompt() dialog may take focus away from a window on some platforms and browsers. Don't forget that your focus handler could be called when the dialog is dismissed if this happens.
The Macintosh version 4.7 of Netscape Navigator does not appear to support focus events.