Example: To store text for pop-up windows in a text file
The text for pop-up windows can be stored in one text file with the .js file name extension. This enables you to store the text for all pop-up windows in your entire help system in a single location. This also enables you to globally define the font attributes to be used for pop-up windows.
- Create your pop-up windows using any text editor, in the following format:
popfont="Facename[, point size[, charset[, PLAIN BOLD ITALIC UNDERLINE]]]"
Text1="The text for the first pop-up window."
Text2="The text for the second pop-up window."
where popfont is the name of the variable that specifies the font attributes for the pop-up text and Text1, Text2, and so on, are the variables that specify the text of each pop-up window.
- Save the file with a .js file name extension.
- Copy the following code into each HTML file from which you want to open a pop-up window. Place the code between the
<HEAD>
start and end tags:<OBJECT
id=HHCTRL type="application/x-oleobject"
classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11" >
</OBJECT>
<SCRIPT language=javascript
SRC="terms.js">
</SCRIPT>
where HHCTRL is the ID of the control that you are referencing, and terms.js is the name of your text file. You might want to include an error handler that is invoked if the specified text file cannot be found.
- Also copy this code in your HTML file to call the TextPopup method of the HTML Help ActiveX control:
<A HREF="JavaScript:HHCTRL.TextPopup(Text1,popfont,9,9,-1,-1)"
Title="Click for pop-up definition">Word to be defined</A>
Notes
- You must add the text file to the
[FILES]
section of your project (.hhp) file. - This procedure cannot be used to create context-sensitive help topics that users open through an external program.
About the script and DHTML examples | |