Inside JavaScript

The onactivate , onbeforedeactivate , and ondeactivate Events

The onactivate event occurs in an object when that object becomes the active element in the document (as with the focus or setActive methods ). The onbeforedeactivate event occurs when an object is the active element and is about to be deactivated (as when another object is going to become the active element), and the ondeactivate event occurs when an object is deactivated. You can find the support for these events in Table 6.55.

Table 6.55. The onactivate , onbeforedeactivate , and ondeactivate Events

Method

NS2

NS3

NS4

NS6

IE3a

IE3b

IE4

IE5

IE5.5

IE6

onactivate

               

x

x

onbeforedeactivate

               

x

x

ondeactivate

                 

x

Only elements that can accept the focus can become the active element. Unless you're specifically handling the case when an element becomes the active element and gets the focus (a document can have only one active element, and that element is stored in the activeElement property), it's probably a good idea to stick to the onfocus and onblur events.

Категории