Key Events in DHTML Applications

See Also

Your DHTML application goes through several main events during its lifetime. There are three objects involved in the life of the application:

The following figure shows how these objects work together:

Page Designer Top-Level Objects

The DHTMLPage object manages the lifetime of your HTML pages with the following sequence of events:

  1. The Initialize event occurs early in the loading process, whenever the run-time DLL for the application is created or recreated by the system. It is always the first event in a DHTML application. When the Initialize event is fired, not all objects on the page have been loaded, so object references may not be valid. Because of this, you should not use the Initialize event to reference and set properties for elements on the page.

  2. The Load event occurs later in the loading process, after the Initialize event. If your page is loading asynchronously, the Load event is fired after the first element on the page has been created. If your page is loading synchronously, the Load event is fired after all of the elements have been created. You can use the Load event to set information on the page.

  3. The Unload event occurs when the end user moves to another page referenced by the DHTMLPageDesigner object or closes the application. During unload, all of the objects on the HTML page still exist. This is therefore a good time to do any state management, cleanup, or other processing that needs to reference items on the page.

  4. The Terminate event occurs when the HTML page is about to be destroyed. None of the objects on the page exist in memory during the terminate event, so you cannot use this event to reference items on the page for state management or other processing.

For More Information   See "Document Object Model" in the "Dynamic HTML" section of the Internet Client SDK for a full list of the properties, methods, and events available for the Document object. For information on how to use the Dynamic HTML object model in Visual Basic, see "Writing Code with Dynamic HTML" in this chapter.