Microsoft Office 2000/Visual Basic Programmer's Guide   

Working with the HTML Help Java Applet

If you need to have compatibility with browsers that don't support ActiveX controls, you can add HTML Help functionality to Web pages by using the HTML Help Java applet.

You can use the HTML Help Java applet to add the following HTML Help features to HTML pages displayed in your frameset:

Note that the HTML Help Java applet doesn't support displaying text pop-up windows. To create similar functionality, you can use the JavaScript alert method of the window object to display a dialog box that contains a text string. For example, the following JavaScript displays a simple pop-up message:

<P>This is a <A HREF='JavaScript:alert("This a JavaScript message.")' TITLE="This is a JavaScript message.">pop-up</A>.</P>

The TITLE attribute of the <A> tag provides a pop-up window for browsers that support this functionality.

To use the HTML Help Java applet from an HTML page, insert an <APPLET> tag similar to the one in the following example:

<APPLET CODE=HHCtrl.class
        ALIGN="baseline"
        WIDTH=240
        HEIGHT=270
        NAME=HHCtrl
        ARCHIVE="HHCtrl.zip">

   <PARAM NAME="Cabbase" VALUE="HHCtrl.cab">
   <PARAM NAME="Command" VALUE="Contents">
   <PARAM NAME="Item1" VALUE="hh_toc_java.hhc">
</APPLET>

The CODE attribute specifies HHCtrl.class, which is the name of the Java class used to load the HTML Help Java applet. Netscape Navigator uses the ARCHIVE attribute to specify a .zip file that contains Java class files. In this case, HHCtrl.zip contains all the Java class files required by the HTML Help Java applet. Similarly, the Cabbase parameter is used by Microsoft Internet Explorer to specify the name of a compressed archive that contains Java class files, in this case in the .cab file format. A copy of HHCtrl.cab is installed in the C:\Program Files\HTML Help Workshop\Java subfolder when you install HTML Help Workshop. You can create your own .zip archive by compressing all the .class files included in the Java subfolder.

The Command parameter is used to specify the kind of HTML Help functionality to be used with this instance of the HTML Help Java applet. You can specify the following commands.

Command Description
Contents Specifies that a table of contents will be displayed based on the information supplied in the HTML Help table of contents file specified in the Item1 parameter (normally an .hhc file). The specified file must reside in the same folder as the document containing the applet. You must also include a copy of cntimage.gif (from the C:\Program Files\HTML Help Workshop\Java folder created when you install HTML Help Workshop) to display folder and document icons in the table of contents tree view.
Index Specifies that an index will be displayed based on the information supplied in the HTML Help index file specified in the Item1 parameter (normally an .hhk file). The specified file must reside in the same folder as the document containing the applet.
Related Topics Specifies that a dialog box listing related topics will be displayed based on the information supplied in one or more Itemn parameters in this format:

<PARAM NAME="Itemn" VALUE="TopicTitle;TopicFile.htm">


You can see additional parameters supported by the Contents, Index, and Related Topics commands by opening an HTML file in HTML Help Workshop, and then clicking HTML Help Control on the Tags menu. A wizard that is used to insert the HTML Help ActiveX control appears. You can select the Table of Contents, Index, or Related Topics command from this wizard to insert an <OBJECT> tag for the selected command. Most of the parameters supported by the <OBJECT> tag for the HTML Help ActiveX control can be used with the corresponding command for the HTML Help Java applet.

To view a sample frameset that uses the HTML Help Java applet to display a table of contents and index for navigation to HTML files and Office documents, see HTMLHelpJava.htm in the ODETools\V9\Samples\OPG\Samples\CH13\Frameset subfolder on the Office 2000 Developer CD-ROM.