Adding Interactive Features
Page 422
9 Click OK to close the Field Properties dialog.
10 Select the hand tool , and move the cursor across the hotspot area. The image field you defined appears as the cursor enters the hotspot area and disappears when it exits.
Working with JavaScript actions
A JavaScript action allows you to invoke a JavaScript from a form field, a link, a bookmark, or a page action. Familiarity with JavaScript is required. Storing a
JavaScript for a commonly used function as a field level script allows you to invoke the function from other JavaScripts. Storing a function as a document level JavaScript makes the function available to all JavaScripts in the current document. Storing a function as a plug-in level script makes the function available to all JavaScripts in the application. Plug-in level scripts are contained in files with a .js extension. These scripts should be located in the Plug-ins folder in the JavaScripts subfolder.
For more information on creating simple JavaScripts, see
Using custom JavaScripts in forms , or choose Help -> Forms JavaScript Guide to display the Acrobat
Forms JavaScript Object Specification. This document provides information about the classes and objects that have been defined to accommodate
Acrobat forms.
Adding Interactive Features
Page 423
To choose the JavaScript action:
1 Create or select a form field, link, bookmark, or page action.
2 Press the right mouse button (Windows) or Control-click (Mac OS), and choose Properties.
3 Click Add, and select JavaScript as the action. For information about selecting an action for a form field, link, bookmark, or page action, see
About action types
.
4 Click Edit.
5 Copy and paste a predefined custom script, or type the script in the text box provided, and then click OK.
6 Click Set Action or Set Link, as appropriate.
To create a document level JavaScript:
1 Choose Tools > Forms > JavaScript Document.
2 Type the name of the script in the text box.
3 Click Add.
4 Copy and paste a predefined custom script, or type the script in the text box provided, and then click OK. The name of the script appears in the lower text box.
5 Click Close.
Adding Interactive Features
Page 424
6 Choose Tools > Forms > JavaScript Console to bring up the console window.
When a JavaScript is launched, any performance issues appear in the console window. Click Clear to clear the results, or Close to close the window.
To edit or delete an existing document level JavaScript:
1 Choose Tools > Forms > Document JavaScripts.
2 To edit a document level JavaScript, select the JavaScript from the list, and click Change. Edit the existing text, or copy and paste a predefined custom script into the text box provided. Click OK to accept and conclude the edits.
3 To delete a document JavaScript, select the JavaScript from the lower text box, and click Delete.
4 Click Close.
To create a JavaScript plug-in level script:
1 Create a text file containing the function JavaScript. Name and save the file with a .js extension.
2 Copy the text file into the Plug-ins directory inside the Acrobat directory
(Windows) or folder (Mac OS).