Javascript Reference
Categories: onbeforeactivate

javascript onbeforeactivate Description

@Aug. 17, 2009, 9:07 a.m.
onbeforeactivate Firefox/Netscape/NN n/a IE 6(Win) Chrome/Safari/DOM n/a  


Bubbles: Yes; Cancelable: Sometimes  

Fires just before an object is to become the active object. Giving an object focus makes it active, but a rendered element can be the active element without having focus. Only one element at a time may be active. See the setActive( ) method of shared objects. If an element received focus, related events fire in the following sequence: onbeforeactivate, onactivate, and onfocus.


If you cancel the onbeforeactivate event, the element does not become active, nor does it receive focus, but only if the intended focus action occurs from explicit user action (clicking and tabbing). An element blocked from receiving focus causes the focus to go to another element: to the next focusable element in tabbing order (when the user tabs to the blocked element) or to the next outermost focusable parent element in the document tree (when a user clicks on the blocked element). Activating or giving focus to an element via the setActive( ) or focus( ) methods cannot be blocked by canceling this event.

Typical Targets

All rendered elements, plus the document and window objects.

Powered by Linode.