WFC wraps the Dynamic HTML (DHTML) object model that is implemented in Internet Explorer 4.0. When you use the Code-Behind HTML template to create a DHTML application, your Java class extends com.ms.wfc.html.DhDocument, and is hosted on an HTML page as a COM object. Using the other classes in the com.ms.wfc.html package, you can manipulate elements on the HTML page.
Note Before you use the following procedure to create a DHTML application, close any projects that you may already have open. (On the File menu, click Close All.)
To create a DHTML application
Note Renaming the Class1.java file does not rename the associated class in the source code, and vice versa. You must manually change all instances of the old name. (Note that you can create an empty project and then add a class with the Class template. This two-step process allows you to name the class before it is created; however, the Class template does not provide the basic code framework for a DHTML class.)
The Code-Behind HTML template already provides some sample functionality. You can view this sample code in the Text editor.
To view the sample code in your DHTML class
The initForm
method is used for initializing your code, including binding elements in your class to existing elements on the HTML page, and creating new elements. The sample implementation binds a DhText object called boundText
to an existing element on Page1.htm (<SPAN id=bindText>Bound Text</SPAN>
). This is accomplished by first calling boundText.setID("bindText")
and then calling setBoundElements
. The sample implementation also adds a new DhText object to the document using the setNewElements
method.
For information about modifying your code in the development environment, see Editing Code.
Because Class1 is to be hosted as a COM object on an HTML page, your project must be packaged into a .cab file. By using the Code-Behind HTML template, a .cab file named ProjectName.cab is automatically created when you build your project.
Once you have built your project, you can launch the associated HTML page from the development environment or simply open the HTML page in your browser.
To build and run your DHTML application
For more information about using DHTML, see Programming Dynamic HTML in Java.