Inserting script links

Navigation:  Basic Working Procedures > Links, Anchors, Macros, Scripts and HTML >

Inserting script links

Previous pageReturn to chapter overviewNext page

Show/Hide Hidden Text

This function inserts a piece of script code that is executed when the user clicks on the link in your help file. Note that scripts are not supported in all output formats – see the  compatibility list below for details.

See Scripts and HTML in the Reference section for some more background information on scripts and how they are implemented and handled.

Click to expand/collapseHow to insert a script link

1.Select text in your document if you want to use it as the link. You don't have to do this: you can enter a completely new caption in the Insert Hyperlink dialog box if you want.

2.Open the Insert Hyperlink dialog box. There are two ways to do this:

Press Ctrl+L

Select the Link tool in Write > Insert

3.Select the Script Link tab:

DLG_Hyperlink_Script

4.Select HTML JavaScript or Winhelp Macro and enter your script or macro in the editing field. (Only four Winhelp macros are supported, see below for details.)

See The Hyperlink dialog for full details on the settings in the dialog.

Click to expand/collapseScript implementation

Help & Manual creates script links by inserting the code you type between <a href=" and ">. For example, if you type:

javascript:alert('Hello World!');

The resulting link created in your output will be:

<a href="javascript:alert('Hello World!');">Link text</a>

This is just a simple example of course, you can place as much code in the script as you want. If you are familiar with JavaScript and HTML you can use this knowledge to create quite complex scripts! You just have to remember that everything you write is inserted between <a href=" and ">. See Scripts, HTML and Macros in the Reference section for more details.

Click to expand/collapseWinhelp macro implementation and translation

Help & Manual no longer supports the obsolete Winhelp format. However, four Winhelp macros are still supported because they are easier to enter than their HTML Help equivalents. You can use them as shorthand versions for these functions in HTML Help output. Help & Manual automatically converts these four macros into the code required in HTML Help CHM files.

Macros translated in HTML Help:

The following four standard Winhelp macros are automatically translated to their HTML equivalents when you publish to HTML Help.

ALink()

KLink()

TCard()

Close()

Note that only keywords are supported as arguments in the ALink and KLink macros when they are used in HTML Help. All other arguments are ignored.

See Scripts, HTML and Macros in the Reference section for full details on how scripts and macros are implemented and handled.

Click to expand/collapseMacro/script link compatibility in output formats

HTML Help:

JavaScript is broadly supported in CHMs. See the MS HTML Help Workshop documentation for details. Four standard Winhelp macros (see above) are translated to their HTML Help equivalents. Do not use paths.

Visual Studio Help:

Same as for HTML Help.

WebHelp:

Scripts are supported but support depends to a great extent on the user's browser, so use the same caution as when using scripting in any HTML pages.

Windows Exe and ePub eBooks:

Script and macro links are not supported.

Adobe PDF:

Script and macro links are not supported.

Word RTF:

Script and macro links are not supported.

See also:

Scripts, HTML and Macros

Inserting plain HTML code

Using HTML templates

WebHelp (Project Configuration)