A DHTML application supports numerous events, many of them quite analogous
to those of a standard VB application. In fact, the names of many DHTML events
are formed from the names of the corresponding standard VB events, but prefixed
by the word on. For example, some common DHTML events are as follows:
-
onclick Corresponds to VB’s
Click event.
-
onmouseup Corresponds to VB’s
MouseUp event.
-
onkeypress Corresponds to VB’s
KeyPress event. Several other DHTML events correspond to VB standard events
in functionality, but have different names:
-
onfocus Corresponds to VB’s
GotFocus event.
-
onblur Corresponds to VB’s
LostFocus event.
Two of the DHTMLPage object’s events (Load and
Unload) are useful for managing critical moments in the lifetime of a DHTML
page. Here is a brief account:
-
Load Occurs during the loading
of the page to the browser. If the loading is asynchronous, the Load event occurs
after the first HTML element is created. If the loading is synchronous, the Load
event occurs after the last HTML element is created.
-
Unload Occurs during the unloading
of the page from the browser, before any HTML elements have been destroyed.
Two other events, Initialize and
Terminate, are generally less useful than Load and
Unload. Initialize happens before all objects
are loaded on the page (and so you can’t trust object references to work
here). Terminate, on the other hand, happens after
all objects have been unloaded (so it’s too late to check object settings).