Teach Yourself ActiveX in 21 Days

Previous Page TOC Next Page



— 5


Programming Inside the Internet Explorer



Introduction


Today you will learn to exploit the programming power that lives inside Microsoft Internet Explorer. Internet Explorer presents a rich set of internal objects, properties, and methods, along with scripting and ActiveX components, that you can use to build smarter, more interactive Web sites. By the end of the day you, will know how to use:


Why Internet Explorer?


There are several Web browsers available for the Internet today. The two primary browsers are Netscape Navigator (http://www.netscape.com/) and Microsoft Internet Explorer (http://www.microsoft.com/). Currently, Internet Explorer is the only browser that supports VBScript and ActiveX controls, so you will be running your scripts and ActiveX controls on it.

The internal object model for Netscape Navigator is similar to the one for Internet Explorer, so what you learn today will at least give you a good start if you ever wind up putting ActiveX components in Netscape Navigator Web pages.

Internet Explorer Object Model


This section has two objectives. First, detail the objects available to the programmer. Second, show how these objects are manipulated through scripting. I will use both VBScript and JavaScript in the examples. Don't worry about the syntax, that's what days 6 and 7 are for.

For those of you who are new to programming, an object is a collection of properties and methods. A window on your computer screen is an object. The window has properties, such as background color, size, and border type. The window also has methods. Methods are ways of doing things. A window usually has a method for expanding itself to fill the whole screen, and another method to reduce itself to an icon. Events are the object's methods that are triggered by the operating system. A good example of an event is clicking your mouse button when the cursor is over a button. By clicking the mouse, you cause the operating system to call the OnClick method of the button. The programmer can place code in this method. You placed code in this event in yesterday's ActiveX Control Pad example, and will be putting code inside events in almost every example you do today.

The Window: Mother of all Objects

The object at the top of the chart is the window object . This object contains 11 properties, 8 methods and 2 events. Lets start with window's properties.

Window Properties

The 11 window properties are