A
A Short Acrobat JavaScript FAQ
How can I define global variables in JavaScript?
Pressing the tab (shift-tab) key when there is no form field that has the keyboard focus will
cause the first (last) field in the tab order on the current page to become active. If there are
no form fields on the page then Acrobat will inform the user of this via a speech cue.
Using tab (shift-tab) while a field has the focus tabs forward (backward) in the tab order to
the next (previous) field. If the field is the last (first) field on the page and the tab (shift-tab)
key is pressed, the focus is set to the first (last) field on the next (previous) page if one exists.
If such a field does not exist, then the focus "loops" to the first (last) field on the current
page.
Reading Order
The reading order of a document is determined by the Tags tree. In order for a form to be
used effectively by a visually impaired user, the content and fields of a page must be
included in the Tags tree. The Tags tree can also indicate the tab order for the fields on a
page.
How can I define global variables in JavaScript?
The Acrobat extensions to JavaScript define a
Global
object to which you can attach
global variables as properties. To define a new global variable called '
myVariable
' and
set it equal to the null string, you would type:
global.myVariable = "";
All of your scripts, no matter where they are in a document, will now be able to reference
this variable.
Making Global Variables Persistent
Global data does not persist across user sessions unless you specifically make your global
varaibles persistent. The predefined
Global
object has a method designed to do this. To
make a variable named '
myVariable
' persist across sessions, use the following syntax:
global.setPersistent("myVariable",true);
In future sessions, the variable will still exist with its previous value intact.
268
Acrobat JavaScript Scripting Guide